diff options
author | Doug Shelley <doug@parelastic.com> | 2015-09-29 02:41:30 +0000 |
---|---|---|
committer | Nikhil Manchanda <SlickNik@gmail.com> | 2015-10-02 02:41:45 -0700 |
commit | 37aea11d771eb7cb7706ea9f5f641cbe42a72fc8 (patch) | |
tree | 3c338fc2914f85bb28ba894dc914a502ba5bc1f2 | |
parent | f6a6a7a0e245c07da3f6c0ffc6a035d696cf95c0 (diff) | |
download | trove-37aea11d771eb7cb7706ea9f5f641cbe42a72fc8.tar.gz |
Fix publish_exists_event authentication exception
The nova client created by create_nova_admin_client was throwing
an Authentication exception. In order to properly create this client,
novaclient needs tenant_id set to a tenant-id. Note: novaclient
documents that project-id is specifically a tenant-name and from
what I can tell it isn't required for Trove use-cases.
Added a unit test to check that create_nova_admin_client causes
a nova client to get instantiated with the correct params.
(cherry picked from commit e1538ae75e37b14905893d91c45dd044d32a7eb0)
Change-Id: I34d7d9dd36117bff796db22b851656ba78988558
Closes-bug: 1473550
-rw-r--r-- | trove/common/remote.py | 4 | ||||
-rw-r--r-- | trove/tests/unittests/common/test_remote.py | 15 |
2 files changed, 16 insertions, 3 deletions
diff --git a/trove/common/remote.py b/trove/common/remote.py index 2bb23651..3f917fad 100644 --- a/trove/common/remote.py +++ b/trove/common/remote.py @@ -98,7 +98,7 @@ def nova_client(context): endpoint_type=CONF.nova_compute_endpoint_type) client = Client(context.user, context.auth_token, - bypass_url=url, project_id=context.tenant, + bypass_url=url, tenant_id=context.tenant, auth_url=PROXY_AUTH_URL) client.client.auth_token = context.auth_token client.client.management_url = url @@ -112,8 +112,6 @@ def create_admin_nova_client(context): """ client = create_nova_client(context) client.client.auth_token = None - client.client.management_url = ("%s/%s" % - (CONF.nova_compute_url, context.tenant)) return client diff --git a/trove/tests/unittests/common/test_remote.py b/trove/tests/unittests/common/test_remote.py index b75b2c1a..21d59b39 100644 --- a/trove/tests/unittests/common/test_remote.py +++ b/trove/tests/unittests/common/test_remote.py @@ -401,6 +401,21 @@ class TestCreateNovaClient(trove_testtools.TestCase): self.assertEqual(self.computev3_public_url_region_two, client.client.management_url) + def test_create_admin_client(self): + nova_url_from_conf = 'http://adminexample.com/' + cfg.CONF.set_override('nova_compute_url', nova_url_from_conf) + admin_user = 'admin1' + admin_pass = 'adminpwd' + admin_tenant_id = uuid.uuid4().hex + admin_client = remote.create_admin_nova_client( + TroveContext(user=admin_user, + auth_token=admin_pass, + tenant=admin_tenant_id)) + self.assertEqual(admin_user, admin_client.client.user) + self.assertEqual(admin_pass, admin_client.client.password) + self.assertEqual('%s%s' % (nova_url_from_conf, admin_tenant_id), + admin_client.client.management_url) + class TestCreateHeatClient(trove_testtools.TestCase): def setUp(self): |