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:
parent
0022ef6975
commit
d1f21ce88b
|
@ -100,7 +100,7 @@ def create_connection(params=None):
|
||||||
params.pop('region_name')
|
params.pop('region_name')
|
||||||
try:
|
try:
|
||||||
conn = connection.Connection(profile=prof, user_agent=USER_AGENT,
|
conn = connection.Connection(profile=prof, user_agent=USER_AGENT,
|
||||||
**params)
|
auth_plugin="password", **params)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
raise parse_exception(ex)
|
raise parse_exception(ex)
|
||||||
|
|
||||||
|
|
|
@ -142,6 +142,7 @@ class OpenStackSDKTest(base.SenlinTestCase):
|
||||||
mock_profile.assert_called_once_with()
|
mock_profile.assert_called_once_with()
|
||||||
mock_conn.assert_called_once_with(profile=x_profile,
|
mock_conn.assert_called_once_with(profile=x_profile,
|
||||||
user_agent=sdk.USER_AGENT,
|
user_agent=sdk.USER_AGENT,
|
||||||
|
auth_plugin="password",
|
||||||
foo='bar')
|
foo='bar')
|
||||||
|
|
||||||
@mock.patch.object(profile, 'Profile')
|
@mock.patch.object(profile, 'Profile')
|
||||||
|
@ -159,7 +160,8 @@ class OpenStackSDKTest(base.SenlinTestCase):
|
||||||
x_profile.set_region.assert_called_once_with(x_profile.ALL,
|
x_profile.set_region.assert_called_once_with(x_profile.ALL,
|
||||||
'REGION_ONE')
|
'REGION_ONE')
|
||||||
mock_conn.assert_called_once_with(profile=x_profile,
|
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(profile, 'Profile')
|
||||||
@mock.patch.object(connection, 'Connection')
|
@mock.patch.object(connection, 'Connection')
|
||||||
|
@ -178,7 +180,8 @@ class OpenStackSDKTest(base.SenlinTestCase):
|
||||||
|
|
||||||
mock_profile.assert_called_once_with()
|
mock_profile.assert_called_once_with()
|
||||||
mock_conn.assert_called_once_with(profile=x_profile,
|
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)
|
mock_parse.assert_called_once_with(ex_raw)
|
||||||
self.assertEqual(123, ex.code)
|
self.assertEqual(123, ex.code)
|
||||||
self.assertEqual('BOOM', ex.message)
|
self.assertEqual('BOOM', ex.message)
|
||||||
|
|
Loading…
Reference in New Issue