Set auth_plugin type to password when building sdk connection

Before the following change[1] being added into formal release of
openstacksdk, user needs to specify auth_plugin type explicitly
when building sdk connection. This patch revises creation_connection
method in senlin sdk driver to make it work.

[1]https://review.openstack.org/248929

Change-Id: I7cf1bfcd5047af80ff0b0843058be55dac7d7dc9
Closes-Bug: #1519684
This commit is contained in:
yanyanhu 2015-11-25 03:49:04 -05:00
parent 0022ef6975
commit d1f21ce88b
2 changed files with 6 additions and 3 deletions

View File

@ -100,7 +100,7 @@ def create_connection(params=None):
params.pop('region_name')
try:
conn = connection.Connection(profile=prof, user_agent=USER_AGENT,
**params)
auth_plugin="password", **params)
except Exception as ex:
raise parse_exception(ex)

View File

@ -142,6 +142,7 @@ class OpenStackSDKTest(base.SenlinTestCase):
mock_profile.assert_called_once_with()
mock_conn.assert_called_once_with(profile=x_profile,
user_agent=sdk.USER_AGENT,
auth_plugin="password",
foo='bar')
@mock.patch.object(profile, 'Profile')
@ -159,7 +160,8 @@ class OpenStackSDKTest(base.SenlinTestCase):
x_profile.set_region.assert_called_once_with(x_profile.ALL,
'REGION_ONE')
mock_conn.assert_called_once_with(profile=x_profile,
user_agent=sdk.USER_AGENT)
user_agent=sdk.USER_AGENT,
auth_plugin="password")
@mock.patch.object(profile, 'Profile')
@mock.patch.object(connection, 'Connection')
@ -178,7 +180,8 @@ class OpenStackSDKTest(base.SenlinTestCase):
mock_profile.assert_called_once_with()
mock_conn.assert_called_once_with(profile=x_profile,
user_agent=sdk.USER_AGENT)
user_agent=sdk.USER_AGENT,
auth_plugin="password")
mock_parse.assert_called_once_with(ex_raw)
self.assertEqual(123, ex.code)
self.assertEqual('BOOM', ex.message)