Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1 from HewlettPackard/master
Browse files Browse the repository at this point in the history
Merge the HPE's Python SDK changes up to 9-15-16.
  • Loading branch information
halprin authored Sep 16, 2016
2 parents 1314520 + 9d67a68 commit a8ef19d
Show file tree
Hide file tree
Showing 113 changed files with 2,539 additions and 1,115 deletions.
120 changes: 63 additions & 57 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,57 +1,63 @@
*.py[cod]

# C extensions
*.so

# Local Certificates
*.pem

# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64
__pycache__

# Rope
.ropeproject/


# Installer logs
pip-log.txt

# Unit test / coverage reports
.coverage
.tox
nosetests.xml

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

#coverage
coverage.xml
.coverage

#virtualenv
env

#pycharm
.idea
.idea/

#Global configuration to run examples
examples/config.json
*.py[cod]

# C extensions
*.so

# Local Certificates
*.pem

# Packages
*.egg
*.egg-info
dist
build/*
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64
__pycache__

# Rope
.ropeproject/


# Installer logs
pip-log.txt

# Unit test / coverage reports
.coverage
.tox
nosetests.xml

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

#coverage
coverage.xml
.coverage

#virtualenv
env

#pycharm
.idea
.idea/

#Global configuration to run examples
examples/config.json

#sphinx generated files
docs/build/*
docs/source/*
!docs/source/conf.py
!docs/source/index.rst
Empty file added .nojekyll
Empty file.
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
language: python
python:
- 2.7
- 2.7
install:
- pip install tox
- pip install tox
script:
- tox
- tox
- "./deploy.sh"

90 changes: 76 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[![Build Status](https://travis-ci.org/HewlettPackard/python-hpOneView.svg?branch=master)](https://travis-ci.org/HewlettPackard/python-hpOneView)

HPE OneView SDK for Python
===========================
# HPE OneView SDK for Python

This library provides a pure Python interface to the HPE OneView REST APIs.

Expand All @@ -10,12 +9,11 @@ by the way you expect to work, with a single integrated view of your IT
infrastructure.

The HPE OneView Python library depends on the
[Python-Future](http://python-future.org/index.htm) library to provide Python
2/3 compatibility. This will be installed automatically if you use the installation
[Python-Future](http://python-future.org/index.htm) library to provide Python
2/3 compatibility. This will be installed automatically if you use the installation
methods described below.

Installation
------------
## Installation

### From source

Expand All @@ -40,17 +38,81 @@ Both of these installation methods work if you are using virtualenv, which you s

### From Pypi

Coming soon
Coming soon.


API Implementation
------------------
## API Implementation

Status listing of the HPE OneView REST interfaces that have been implemented in the Python library so far is hosted in the [Wiki section](https://github.com/HewlettPackard/python-hpOneView/wiki/API-Implementation)
A status of the HPE OneView REST interfaces that have been implemented in this Python library can be found in the [Wiki section](https://github.com/HewlettPackard/python-hpOneView/wiki/HPE-OneView-API-Version-200-Implementation-Status).


Logging
-------
## Logging

This module uses Python’s Standard Library logging module. An example of how to configure logging was provided on ```/examples/logger.py ```.
To see more configuration options, look at [configuring logging](https://docs.python.org/3/howto/logging.html#configuring-logging)
This module uses Python’s Standard Library logging module. An example of how to configure logging is provided on [```/examples/logger.py```](/examples/logger.py).

More information about the logging configuration can be found in the Python Documentation.

## Configuration

### JSON

Connection properties for accessing the OneView appliance can be set in a JSON file.

Before running the samples or your own scrips, you must create the JSON file.
An example can be found at: [OneView configuration sample](examples/config-rename.json).

Once you have created the JSON file, you can initialize the OneViewClient:

```python
oneview_client = OneViewClient.from_json_file('/path/config.json')
```

:lock: Tip: Check the file permissions because the password is stored in clear-text.

### Dictionary

You can also set the configuration using a dictionary:

```python
config = {
"ip": "172.16.102.82",
"credentials": {
"userName": "username",
"password": "password"
}
}

oneview_client = OneViewClient(config)
```

:lock: Tip: Check the file permissions because the password is stored in clear-text.

### Proxy

If your environment requires a proxy, define the proxy properties in the JSON file using the following syntax:

```json
"proxy": "<proxy_host>:<proxy_port>"
```

## Contributing and feature requests

**Contributing:** You know the drill. Fork it, branch it, change it, commit it, and pull-request it.
We are passionate about improving this project, and glad to accept help to make it better. However, keep the following in mind:

- You must sign a Contributor License Agreement first. Contact one of the authors (from Hewlett Packard Enterprise) for details and the CLA.
- We reserve the right to reject changes that we feel do not fit the scope of this project, so for feature additions, please open an issue to discuss your ideas before doing the work.

**Feature Requests:** If you have a need that is not met by the current implementation, please let us know (via a new issue).
This feedback is crucial for us to deliver a useful product. Do not assume that we have already thought of everything, because we assure you that is not the case.

## Testing

We've already packaged everything you need to do to check if the code is passing the tests.
The tox script wraps the unit tests execution against Python 2 and 3, flake8 validation, and the test coverage report generation.

Run the following command:

```
$ tox
```
69 changes: 69 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash
set -e # Exit with nonzero exit code if anything fails

SOURCE_BRANCH="master"
TARGET_BRANCH="gh-pages"

# Pull requests and commits to other branches shouldn't try to deploy, just build to verify
if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]; then
echo "Skipping deploy; just doing a build."
exit 0
fi

# Save some useful information
REPO=`git config remote.origin.url`
SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:}
SHA=`git rev-parse --verify HEAD`

# Clone the existing gh-pages for this repo into out/
# Create a new empty branch if gh-pages doesn't exist yet (should only happen on first deply)
rm -rf out || exit 0

git clone $REPO out
cd out
git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH
cd ..


# Clean out existing contents
rm -rf out/**/* || exit 0

# Copy generated documentation to the new directory
cp -a docs/build/html/. out/


cd out
git config user.name "Travis CI"
git config user.email "[email protected]"

# If there are no changes (e.g. this is a README update) then just bail.
if [ $(git status --porcelain | wc -l) -lt 1 ]; then
echo "No changes to the spec on this push; exiting."
exit 0
fi

# Commit the "changes", i.e. the new version.
# The delta will show diffs between new and old versions.
git add -A .
git commit -m "Deploy to GitHub Pages: ${SHA}"


## Get the deploy key by using Travis's stored variables to decrypt deploy_key.enc
openssl aes-256-cbc -K $encrypted_207a3e71573a_key -iv $encrypted_207a3e71573a_iv -in deploy_key.enc -out deploy_key -d


chmod 600 deploy_key

eval `ssh-agent -s`

ssh-add deploy_key


## Now that we're all set up, we can push.
git push $SSH_REPO $TARGET_BRANCH

echo "Documentation pushed to gh-pages ................................"
cd ..
rm -rf out || exit 0

echo "Documentation deploy finished ..................................."
Binary file added deploy_key.enc
Binary file not shown.
Loading

0 comments on commit a8ef19d

Please sign in to comment.