Repository: libcloud Updated Branches: refs/heads/trunk d7917ef5a -> e63adedf0
[LIBCLOUD-577] Add an example to OpenStack driver documentation which shows how to specify a tenant name. Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/a2694af1 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/a2694af1 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/a2694af1 Branch: refs/heads/trunk Commit: a2694af1a52b5377bebeeaf378c3b9bfbb05a21f Parents: d7917ef Author: Tomaz Muraus <[email protected]> Authored: Tue Aug 5 22:40:24 2014 +0200 Committer: Tomaz Muraus <[email protected]> Committed: Tue Aug 5 22:42:56 2014 +0200 ---------------------------------------------------------------------- docs/compute/drivers/openstack.rst | 14 ++++++++++++-- docs/examples/compute/openstack/tenant_name.py | 9 +++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/a2694af1/docs/compute/drivers/openstack.rst ---------------------------------------------------------------------- diff --git a/docs/compute/drivers/openstack.rst b/docs/compute/drivers/openstack.rst index 0d46fb7..ecf57d8 100644 --- a/docs/compute/drivers/openstack.rst +++ b/docs/compute/drivers/openstack.rst @@ -48,6 +48,7 @@ Available arguments: Unless you are working with a very old version of OpenStack you will either want to use ``2.0_apikey`` or ``2.0_password``. +* ``ex_tenant_name`` - tenant / project name * ``ex_force_auth_token`` - token which is used for authentication. If this argument is provided, normal authentication flow is skipped and the OpenStack API endpoint is directly hit with the provided token. @@ -104,8 +105,17 @@ token before the currently used one is about to expire. .. literalinclude:: /examples/compute/openstack/force_auth_token.py :language: python -5. HP Cloud (www.hpcloud.com) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +5. Connecting and specifying a tenant +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This example shows how to connect to OpenStack installation which requires you +to specify a tenant (``ex_tenant_name`` argument). + +.. literalinclude:: /examples/compute/openstack/tenant_name.py + :language: python + +6. HP Cloud (www.hpcloud.com) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Connecting to HP Cloud US West and US East (OpenStack Havana). http://git-wip-us.apache.org/repos/asf/libcloud/blob/a2694af1/docs/examples/compute/openstack/tenant_name.py ---------------------------------------------------------------------- diff --git a/docs/examples/compute/openstack/tenant_name.py b/docs/examples/compute/openstack/tenant_name.py new file mode 100644 index 0000000..bc5d7f4 --- /dev/null +++ b/docs/examples/compute/openstack/tenant_name.py @@ -0,0 +1,9 @@ +from libcloud.compute.types import Provider +from libcloud.compute.providers import get_driver + + +OpenStack = get_driver(Provider.OPENSTACK) +driver = OpenStack('your_auth_username', 'your_auth_password', + ex_tenant_name='mytenant', + ex_force_auth_url='http://192.168.1.101:5000', + ex_force_auth_version='2.0_password')
