Skip to content

Commit

Permalink
Merge pull request #9 from oracle/release_120
Browse files Browse the repository at this point in the history
1.2.0 Release
  • Loading branch information
briangustafson authored Mar 29, 2017
2 parents 27cf90b + f1079b6 commit 87c08f9
Show file tree
Hide file tree
Showing 21 changed files with 581 additions and 147 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ All notable changes to this project will be documented in this file.

The format is based on `Keep a Changelog <http://keepachangelog.com/>`_.

====================
1.2.0 - 2017-03-28
====================

-------
Fixed
-------

* Allow service responses to deserialize to base classes when unknown subtypes are returned. Previously this would result in an exception.

-------
Added
-------

* Support hostnames for instances and DNS labels for VCNs and subnets.

====================
1.1.2 - 2017-03-16
====================
Expand Down
148 changes: 47 additions & 101 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ This topic describes how to install, configure, and use the Oracle Bare Metal Cl
The Python SDK supports operations for the following services:

* Identity and Access Management Service
* Object Storage Service
* Core Services (Networking Service, Compute Service, and Block Volume Service)
* Object Storage Service

===============
Prerequisites
Expand All @@ -22,25 +22,25 @@ The Python SDK supports operations for the following services:
Oracle Bare Metal Cloud Services policies, see `Common Policies`_ in the User Guide.
* Python version 2.7.5 or 3.5 or later, running on Mac, Windows, or Linux.
* The Python SDK uses the `cryptography.io`_ library, which has its own additional `build requirements`_.
* The Python SDK requires `TLS 1.2`_, which versions of `openssl`_ before 1.0.1 do not provide.
If your version of Python was built against an earlier version, you will need to install a new
Python that links against a newer version.
* A keypair used for signing API requests, with the public key uploaded to Oracle. Only the user calling
the API should be in possession of the private key. See Configuring the SDK below.
the API should be in possession of the private key. (For more information, see `Configuring the SDK`_.)

.. _Adding Users: https://docs.us-phoenix-1.oraclecloud.com/Content/GSG/Tasks/addingusers.htm
.. _Common Policies: https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/commonpolicies.htm
.. _cryptography.io: https://cryptography.io/en/latest/
.. _build requirements: https://cryptography.io/en/latest/installation/
.. _TLS 1.2: https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdks.htm
.. _PyPI: https://pypi.python.org/pypi
.. _openssl: https://www.openssl.org/

====================================
Downloading and Installing the SDK
====================================

You can install the Python SDK from GitHub or through the Python Package Index (PyPI).
You can install the Python SDK through the Python Package Index (PyPI), or alternatively through GitHub.

**PyPi**

To install from `PyPI <https://pypi.python.org/pypi/oraclebmc>`_:

Use the following command::

pip install oraclebmc

**GitHub**

To install from GitHub:

Expand All @@ -56,15 +56,10 @@ To install from GitHub:
If you're unable to install the whl file, make sure pip is up to date.
Use ``pip install -U pip`` and then try to install the whl file again.

To install from `PyPI <https://pypi.python.org/pypi/oraclebmc>`_:

Use the following command::

pip install oraclebmc
**Virtual environment (Optional)**


(Optional)
Oracle recommends that you run the SDK in a virtual environment with virtualenv.
Although optional, Oracle recommends that you run the SDK in a virtual environment with virtualenv.

With Linux, it's usually in a separate package from the main Python package.
If you need to install virtualenv, use pip install virtualenv.
Expand All @@ -89,104 +84,55 @@ For instructions, see `SDK and Tool Configuration`_ in the User Guide.

.. _SDK and Tool Configuration: https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm

====================
Note for OSX Users
====================
Verify OpenSSL Version
----------------------

OS X already has Python and OpenSSL preinstalled. However, the preinstalled OpenSSL is probably not version 1.0.x or
newer, which is what you need. To check whether you have a supported OpenSSL version, run this command::
The supported version of OpenSSL for the Python SDK is version 1.0.1 or newer. Run the following command to find out the version of OpenSSL that you have::

python -c "import ssl; print(ssl.OPENSSL_VERSION)"

If the version is ``0.9.x``, you need to reinstall Python and OpenSSL using Homebrew
(a package manager for the OS X platform).

If you've never used Homebrew to install Python on the system, follow these instructions:

1. Download and install `Homebrew`_.
2. Use these commands to update Homebrew and then install OpenSSL and Python:
::
If the version is lower than ``1.0.1``, run the following command to bypass the version issue::

brew update
brew install openssl
brew install python

.. note::
pip install requests[security]

If you get a "Permission denied" message when running any brew command, it's probably because
the OS X permissions model conflicts with Homebrew's default installation location of ``/usr/local``.
You can usually fix this by taking back control of the folder with ``sudo chown -R $(whoami) /usr/local``.
This command instructs the `requests <https://pypi.python.org/pypi/requests>`_
library used by the Python SDK to use the version of OpenSSL that is bundled with the `cryptography <https://pypi.python.org/pypi/cryptography>`_
library used by the SDK.

Check the OpenSSL version again. If it's still 0.9, see `Troubleshooting Mac Issues`_.
**Note:**
If you don't want to use ``requests[security]`` you can update OpenSSL as you normally would. For example, on OS X, use Homebrew to update OpenSSL using the following commands::

.. _Homebrew: http://brew.sh/
brew update
brew install openssl
brew install python

=================
Troubleshooting
=================

You might encounter issues when installing Python or the SDK, or using the SDK itself.

----------------------------
Troubleshooting OEL Issues
----------------------------
On OEL 7.3, if you encounter permission issues when running pip install, you might need to use ``sudo``.
Service Errors
--------------
Any operation resulting in a service error will cause an exception of type oraclebmc.exceptions.ServiceError to be thrown by the SDK. For information about common service errors returned by BMCS, see `API Errors <https://docs.us-phoenix-1.oraclecloud.com/Content/API/References/apierrors.htm>`_
.

----------------------------
Troubleshooting Mac Issues
----------------------------
Oracle Linux Permission Issues
------------------------------
On Oracle Linux 7.3, if you encounter permission issues when running pip install, you might need to use ``sudo``.

There are several general types of issues you might encounter.

OpenSSL Version Still 0.9.x
===========================

If the Python installation instructions listed in Mac above still result in OpenSSL version 0.9.x,
it might be one of these reasons:

* Your python command is pointing to the wrong Python installation. To check, use the which python command.
The default system Python is at ``/usr/bin/python``, whereas the Homebrew-installed version that you want
is typically at ``usr/local/bin``. Edit the ``etc/paths`` file to move the ``usr/local/bin`` line to the
top of the list. Don't remove the system Python line.

* Your virtualenv is pointing to the wrong Python installation. By default, virtualenv uses ``/usr/bin/python``,
whereas the Homebrew-installed Python is typically at ``usr/local/bin``. To fix this, use this command::

virtualenv -p <path to Homebrew Python> <directory for the virtualenv>

For example, if your installation is at /usr/local/bin/python::

virtualenv -p /usr/local/bin/python bmcs_sdk_env

To determine the location of your Homebrew-installed Python, try one of these commands::

brew info python
which -a python # (the -a option lists all the Python installations)
brew doctor

If the above items don't fix the problem, the best strategy is to uninstall and reinstall Python with the following
commands. Note that you will need to reinstall any packages you previously installed into Homebrew's Python via pip.
::

brew uninstall openssl
brew uninstall python
brew update
brew install python

If you're still having problems, you may need slightly different commands depending on the version of Homebrew
that was used to install your Python or OpenSSL libraries. Here's a recent post that may be helpful:
`Updating Python and OpenSSL on OS X`__.

__ https://community.dev.hpe.com/t5/Blogs/Updating-Python-and-Openssl-on-OS-X/ba-p/237791

SSL/TLS or Certificate Exception
================================

When trying to use the SDK, if you get an exception related to SSL/TLS or certificates/certificate validation,
the underlying issue is that OpenSSL is the wrong version (0.9.x). See the solution for uninstalling and
reinstalling Python above. Make sure to also reinstall the wheel with this command::

pip install oraclebmc-*-py2.py3-none-any.whl
SSL/TLS or Certificate Issues
-----------------------------

When trying to use the SDK, if you get an exception related to SSL/TLS or certificates/certificate validation, see the command for installing requests[security] in `Verify OpenSSL Version`_.


.. _Adding Users: https://docs.us-phoenix-1.oraclecloud.com/Content/GSG/Tasks/addingusers.htm
.. _Common Policies: https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/commonpolicies.htm
.. _cryptography.io: https://cryptography.io/en/latest/
.. _build requirements: https://cryptography.io/en/latest/installation/
.. _TLS 1.2: https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdks.htm
.. _PyPI link: https://pypi.python.org/pypi
.. _openssl: https://www.openssl.org/
.. _ConfiguringSDK: Configuring the SDK
.. _OSXUsers: Verify OpenSSL Version
4 changes: 2 additions & 2 deletions oraclebmc/core/models/attach_volume_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def get_subtype(object_dictionary):

if type == 'iscsi':
return 'AttachIScsiVolumeDetails'

raise ValueError('Could not resolve subtype type based on the object dictionary.')
else:
return 'AttachVolumeDetails'

@property
def display_name(self):
Expand Down
63 changes: 63 additions & 0 deletions oraclebmc/core/models/create_subnet_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def __init__(self):
'compartment_id': 'str',
'dhcp_options_id': 'str',
'display_name': 'str',
'dns_label': 'str',
'route_table_id': 'str',
'security_list_ids': 'list[str]',
'vcn_id': 'str'
Expand All @@ -26,6 +27,7 @@ def __init__(self):
'compartment_id': 'compartmentId',
'dhcp_options_id': 'dhcpOptionsId',
'display_name': 'displayName',
'dns_label': 'dnsLabel',
'route_table_id': 'routeTableId',
'security_list_ids': 'securityListIds',
'vcn_id': 'vcnId'
Expand All @@ -36,6 +38,7 @@ def __init__(self):
self._compartment_id = None
self._dhcp_options_id = None
self._display_name = None
self._dns_label = None
self._route_table_id = None
self._security_list_ids = None
self._vcn_id = None
Expand Down Expand Up @@ -170,6 +173,66 @@ def display_name(self, display_name):
"""
self._display_name = display_name

@property
def dns_label(self):
"""
Gets the dns_label of this CreateSubnetDetails.
A DNS label for the subnet, used in conjunction with the VNIC's hostname and
VCN's DNS label to form a fully qualified domain name (FQDN) for each VNIC
within this subnet (e.g., `bminstance-1.subnet-123.vcn-1.oraclevcn.com`).
Must be unique within the VCN and comply with
`RFC 952`__ and
`RFC 1123`__. The value cannot be changed.
This value must be set if you want to use the VCN Resolver to resolve the
hostnames of instances in the subnet. It can only be set if the VCN itself
was created with a DNS label.
For more information, see
`DNS in Your Virtual Cloud Network`__.
Example: `subnet-123`
__ https://tools.ietf.org/html/rfc952
__ https://tools.ietf.org/html/rfc1123
__ {{DOC_SERVER_URL}}/Content/Network/Concepts/dns.htm
:return: The dns_label of this CreateSubnetDetails.
:rtype: str
"""
return self._dns_label

@dns_label.setter
def dns_label(self, dns_label):
"""
Sets the dns_label of this CreateSubnetDetails.
A DNS label for the subnet, used in conjunction with the VNIC's hostname and
VCN's DNS label to form a fully qualified domain name (FQDN) for each VNIC
within this subnet (e.g., `bminstance-1.subnet-123.vcn-1.oraclevcn.com`).
Must be unique within the VCN and comply with
`RFC 952`__ and
`RFC 1123`__. The value cannot be changed.
This value must be set if you want to use the VCN Resolver to resolve the
hostnames of instances in the subnet. It can only be set if the VCN itself
was created with a DNS label.
For more information, see
`DNS in Your Virtual Cloud Network`__.
Example: `subnet-123`
__ https://tools.ietf.org/html/rfc952
__ https://tools.ietf.org/html/rfc1123
__ {{DOC_SERVER_URL}}/Content/Network/Concepts/dns.htm
:param dns_label: The dns_label of this CreateSubnetDetails.
:type: str
"""
self._dns_label = dns_label

@property
def route_table_id(self):
"""
Expand Down
Loading

0 comments on commit 87c08f9

Please sign in to comment.