diff --git a/tripleo_common/actions/deployment.py b/tripleo_common/actions/deployment.py index 132801627..b1470b773 100644 --- a/tripleo_common/actions/deployment.py +++ b/tripleo_common/actions/deployment.py @@ -14,9 +14,7 @@ # under the License. import json import logging -import six import time -import uuid from heatclient.common import deployment_utils from heatclient import exc as heat_exc @@ -152,8 +150,6 @@ class DeployStackAction(templates.ProcessTemplatesAction): parameters['DeployIdentifier'] = int(time.time()) parameters['UpdateIdentifier'] = '' parameters['StackAction'] = 'CREATE' if stack_is_new else 'UPDATE' - if stack_is_new: - parameters['CephClusterFSID'] = six.text_type(uuid.uuid1()) if 'parameter_defaults' not in wf_env.variables: wf_env.variables['parameter_defaults'] = {} diff --git a/tripleo_common/constants.py b/tripleo_common/constants.py index 21cd1c8d4..3b69f8ce6 100644 --- a/tripleo_common/constants.py +++ b/tripleo_common/constants.py @@ -63,6 +63,7 @@ PASSWORD_PARAMETER_NAMES = ( 'CeilometerPassword', 'CephAdminKey', 'CephClientKey', + 'CephClusterFSID', 'CephMonKey', 'CephRgwKey', 'CinderPassword', diff --git a/tripleo_common/tests/actions/test_deployment.py b/tripleo_common/tests/actions/test_deployment.py index 51e66864f..d9b2bb0e2 100644 --- a/tripleo_common/tests/actions/test_deployment.py +++ b/tripleo_common/tests/actions/test_deployment.py @@ -194,7 +194,6 @@ class DeployStackActionTest(base.TestCase): def setUp(self,): super(DeployStackActionTest, self).setUp() - @mock.patch('uuid.uuid1') @mock.patch('tripleo_common.actions.deployment.time') @mock.patch('heatclient.common.template_utils.' 'process_multiple_environments_and_files') @@ -209,8 +208,7 @@ class DeployStackActionTest(base.TestCase): mock_get_object_client, mock_get_workflow_client, mock_get_template_contents, mock_process_multiple_environments_and_files, - mock_time, - mock_uuid1): + mock_time): mock_ctx.return_value = mock.MagicMock() # setup swift @@ -242,15 +240,11 @@ class DeployStackActionTest(base.TestCase): # freeze time at datetime.datetime(2016, 9, 8, 16, 24, 24) mock_time.time.return_value = 1473366264 - # fake an uuid1 for CephClusterFSID - mock_uuid1.return_value = 'some-uuid1' - action = deployment.DeployStackAction(1, 'overcloud') action.run() # verify parameters are as expected - expected_defaults = {'CephClusterFSID': 'some-uuid1', - 'DeployIdentifier': 1473366264, + expected_defaults = {'DeployIdentifier': 1473366264, 'StackAction': 'CREATE', 'UpdateIdentifier': '', 'random_existing_data': 'a_value'} diff --git a/tripleo_common/utils/passwords.py b/tripleo_common/utils/passwords.py index 4bd36a37a..84fabf25e 100644 --- a/tripleo_common/utils/passwords.py +++ b/tripleo_common/utils/passwords.py @@ -17,8 +17,11 @@ import logging import os import struct import time +import uuid import passlib.utils as passutils +import six + from tripleo_common import constants @@ -41,9 +44,13 @@ def generate_overcloud_passwords(mistralclient, stack_env=None): # a Heat stack that already exists. if stack_env and name in stack_env.get('parameter_defaults', {}): passwords[name] = stack_env['parameter_defaults'][name] - # CephX keys aren't random strings elif name.startswith("Ceph"): - passwords[name] = create_cephx_key() + if name == "CephClusterFSID": + # The FSID must be a UUID + passwords[name] = six.text_type(uuid.uuid1()) + else: + # CephX keys aren't random strings + passwords[name] = create_cephx_key() # The SnmpdReadonlyUserPassword is stored in a mistral env. elif name == 'SnmpdReadonlyUserPassword': passwords[name] = get_snmpd_readonly_user_password(mistralclient)