Don't require mistralclient for password gen
Update the generate_overcloud_passwords function so that it no longer explicitly requires mistralclient. This is useful to the python-tripleoclient undercloud installer which would like to re-use this function and does not currently run mistral. This patch also renames the function so that it is more clear these passwords would get used by both the undercloud and overcloud installers. Change-Id: I87fe5b3c2237d2f5a9b3b4b97216b87c548cf78d
This commit is contained in:
parent
54e51b0e6f
commit
ed63e5a53b
|
@ -161,7 +161,7 @@ class GeneratePasswordsAction(base.TripleOAction):
|
|||
except heat_exc.HTTPNotFound:
|
||||
stack_env = None
|
||||
|
||||
passwords = password_utils.generate_overcloud_passwords(wc, stack_env)
|
||||
passwords = password_utils.generate_passwords(wc, stack_env)
|
||||
|
||||
# if passwords don't yet exist in mistral environment
|
||||
if 'passwords' not in wf_env.variables:
|
||||
|
|
|
@ -49,13 +49,13 @@ class TestPasswords(base.TestCase):
|
|||
"undercloud_ceilometer_snmpd_password": snmpd_password
|
||||
})
|
||||
|
||||
# generate_overcloud_passwords will be called multiple times
|
||||
# generate_passwords will be called multiple times
|
||||
# but the order is based on how the strings are hashed, and thus
|
||||
# not really predictable. So, make sure it is a unique one of the
|
||||
# generated values
|
||||
|
||||
mock_create_creds.side_effect = keys
|
||||
value = password_utils.generate_overcloud_passwords(mock_mistral)
|
||||
value = password_utils.generate_passwords(mock_mistral)
|
||||
self.assertIn(value['KeystoneCredential0'], keys)
|
||||
self.assertIn(value['KeystoneCredential1'], keys)
|
||||
self.assertIn(value['KeystoneFernetKey0'], keys)
|
||||
|
|
|
@ -29,11 +29,14 @@ _MIN_PASSWORD_SIZE = 25
|
|||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def generate_overcloud_passwords(mistralclient, stack_env=None):
|
||||
"""Create the passwords needed for the overcloud
|
||||
def generate_passwords(mistralclient=None, stack_env=None):
|
||||
"""Create the passwords needed for deploying OpenStack via t-h-t.
|
||||
|
||||
This will create the set of passwords required by the overcloud, store
|
||||
them in the output file path and return a dictionary of passwords.
|
||||
This will create the set of passwords required by the undercloud and
|
||||
overcloud installers that use tripleo-heat-templates and return them
|
||||
as a dict. The mistralclient is optional and only used to obtain
|
||||
the previously stored SnmpdReadonlyUserPassword supplied by the
|
||||
undercloud to the overcloud deployment.
|
||||
"""
|
||||
|
||||
passwords = {}
|
||||
|
@ -51,8 +54,9 @@ def generate_overcloud_passwords(mistralclient, stack_env=None):
|
|||
else:
|
||||
# CephX keys aren't random strings
|
||||
passwords[name] = create_cephx_key()
|
||||
# The SnmpdReadonlyUserPassword is stored in a mistral env.
|
||||
elif name == 'SnmpdReadonlyUserPassword':
|
||||
# The underclouds SnmpdReadonlyUserPassword is stored in a mistral env
|
||||
# for the overcloud.
|
||||
elif mistralclient and name == 'SnmpdReadonlyUserPassword':
|
||||
passwords[name] = get_snmpd_readonly_user_password(mistralclient)
|
||||
elif name in ('KeystoneCredential0', 'KeystoneCredential1',
|
||||
'KeystoneFernetKey0', 'KeystoneFernetKey1'):
|
||||
|
|
Loading…
Reference in New Issue