Merge lp:~ajkavanagh/charm-helpers/fix-novaclient-v1_1 into lp:charm-helpers

Proposed by Alex Kavanagh
Status: Merged
Merged at revision: 548
Proposed branch: lp:~ajkavanagh/charm-helpers/fix-novaclient-v1_1
Merge into: lp:charm-helpers
Diff against target: 31 lines (+5/-2)
1 file modified
charmhelpers/contrib/openstack/amulet/utils.py (+5/-2)
To merge this branch: bzr merge lp:~ajkavanagh/charm-helpers/fix-novaclient-v1_1
Reviewer Review Type Date Requested Status
Liam Young (community) Approve
Review via email: mp+289050@code.launchpad.net

Description of the change

  Fix lp:1555643 - c.o.amulet.utils imports removed novaclient.v1_1 module

  As per http://docs.openstack.org/developer/python-novaclient/api.html
  the novaclient module needs to be imported as:

  from novaclient import client
  c = client.Client(VERSION, ...)

  as opposed to

  from novaclient.VERSION import client
  c = client.Client(...)

To post a comment you must log in.
Revision history for this message
Liam Young (gnuoy) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charmhelpers/contrib/openstack/amulet/utils.py'
2--- charmhelpers/contrib/openstack/amulet/utils.py 2016-03-11 10:58:21 +0000
3+++ charmhelpers/contrib/openstack/amulet/utils.py 2016-03-15 14:18:58 +0000
4@@ -31,7 +31,7 @@
5 from keystoneclient import session as keystone_session
6 from keystoneclient.v3 import client as keystone_client_v3
7
8-import novaclient.v1_1.client as nova_client
9+import novaclient.client as nova_client
10 import pika
11 import swiftclient
12
13@@ -42,6 +42,8 @@
14 DEBUG = logging.DEBUG
15 ERROR = logging.ERROR
16
17+NOVA_CLIENT_VERSION = "2"
18+
19
20 class OpenStackAmuletUtils(AmuletUtils):
21 """OpenStack amulet utilities.
22@@ -249,7 +251,8 @@
23 self.log.debug('Authenticating nova user ({})...'.format(user))
24 ep = keystone.service_catalog.url_for(service_type='identity',
25 endpoint_type='publicURL')
26- return nova_client.Client(username=user, api_key=password,
27+ return nova_client.Client(NOVA_CLIENT_VERSION,
28+ username=user, api_key=password,
29 project_id=tenant, auth_url=ep)
30
31 def authenticate_swift_user(self, keystone, user, password, tenant):

Subscribers

People subscribed via source and target branches