make sure os_password is set for auth_plugins

os_password is not set anywhere for auth_plugins.  It is only set for
keystone sessions.  This makes sure that it gets set before being passed
to Client.

Closes-Bug: #1493977
Change-Id: I94421fd6fa58be391dfe8a9a14479bb4c17c5231
This commit is contained in:
Daniel Wallace 2015-09-09 14:19:09 -05:00
parent e612205ab8
commit b547a3da50
2 changed files with 19 additions and 0 deletions

View File

@ -683,6 +683,9 @@ class OpenStackComputeShell(object):
project_name=project_name,
project_domain_id=args.os_project_domain_id,
project_domain_name=args.os_project_domain_name)
else:
# set password for auth plugins
os_password = args.os_password
if not do_help and not any([args.os_tenant_id, args.os_tenant_name,
args.os_project_id, args.os_project_name]):

View File

@ -58,6 +58,13 @@ FAKE_ENV4 = {'OS_USER_ID': 'user_id',
'OS_ENDPOINT_TYPE': 'osURL',
'OS_COMPUTE_API_VERSION': '2'}
FAKE_ENV5 = {'OS_USERNAME': 'username',
'OS_PASSWORD': 'password',
'OS_TENANT_NAME': 'tenant_name',
'OS_AUTH_URL': 'http://no.where/v2.0',
'OS_COMPUTE_API_VERSION': '2',
'OS_AUTH_SYSTEM': 'rackspace'}
def _create_ver_list(versions):
return {'versions': {'values': versions}}
@ -495,6 +502,15 @@ class ShellTest(utils.TestCase):
self.shell,
'--os-compute-api-version 2.3 list')
@mock.patch('novaclient.client.Client')
def test_custom_auth_plugin(self, mock_client):
self.make_env(fake_env=FAKE_ENV5)
self.shell('list')
password = mock_client.call_args_list[0][0][2]
client_kwargs = mock_client.call_args_list[0][1]
self.assertEqual(password, 'password')
self.assertIs(client_kwargs['session'], None)
class TestLoadVersionedActions(utils.TestCase):