Merge "Set DeployIndentifier early in tripleoclient-parameters.yaml"

This commit is contained in:
Zuul 2021-01-08 05:34:10 +00:00 committed by Gerrit Code Review
commit 2626c0e72d
2 changed files with 29 additions and 12 deletions

View File

@ -246,6 +246,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
'NeutronPublicInterface': 'nic1',
'NtpServer': '',
'SnmpdReadonlyUserPassword': 'PASSWORD',
'DeployIdentifier': 12345678,
'RootStackName': 'overcloud',
'StackAction': 'UPDATE',
'UndercloudHostsEntries': [
'192.168.0.1 uc.ctlplane.localhost uc.ctlplane'],
@ -346,6 +348,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
parameters_env = {
'parameter_defaults': {
'StackAction': 'CREATE',
'DeployIdentifier': 12345678,
'RootStackName': 'overcloud',
'UndercloudHostsEntries':
['192.168.0.1 uc.ctlplane.localhost uc.ctlplane'],
'CtlplaneNetworkAttributes': {}}}
@ -481,6 +485,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
'NtpServer': '',
'SnmpdReadonlyUserPassword': 'PASSWORD',
'StackAction': 'CREATE',
'DeployIdentifier': 12345678,
'RootStackName': 'overcloud',
'UndercloudHostsEntries': [
'192.168.0.1 uc.ctlplane.localhost uc.ctlplane'
],
@ -1238,6 +1244,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
'NeutronTunnelTypes': 'gre',
'SnmpdReadonlyUserPassword': 'PASSWORD',
'StackAction': 'CREATE',
'DeployIdentifier': 12345678,
'RootStackName': 'overcloud',
'NtpServer': 'ntp',
'UndercloudHostsEntries': [
'192.168.0.1 uc.ctlplane.localhost uc.ctlplane'
@ -1552,11 +1560,15 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
# assuming heat deploy consumed a 3m out of total 451m timeout
with mock.patch('time.time', side_effect=[0, 1585820346,
0, 0, 1585820526]):
0, 12345678, 0,
1585820526]):
self.cmd.take_action(parsed_args)
self.assertIn(
[mock.call(mock.ANY, mock.ANY, 'overcloud', mock.ANY,
{'StackAction': 'UPDATE', 'UndercloudHostsEntries':
{'StackAction': 'UPDATE',
'DeployIdentifier': 12345678,
'RootStackName': 'overcloud',
'UndercloudHostsEntries':
['192.168.0.1 uc.ctlplane.localhost uc.ctlplane'],
'CtlplaneNetworkAttributes': {}}, {}, 451, mock.ANY,
{}, False, False, False, None, deployment_options={})],

View File

@ -73,13 +73,7 @@ class DeployOvercloud(command.Command):
'Assuming --deployed-server')
parsed_args.deployed_server = True
def _update_parameters(self, args, stack):
parameters = {}
stack_is_new = stack is None
parameters['StackAction'] = 'CREATE' if stack_is_new else 'UPDATE'
def _update_args_from_answers_file(self, args):
# Update parameters from answers file:
if args.answers_file is not None:
with open(args.answers_file, 'r') as answers_file:
@ -92,6 +86,19 @@ class DeployOvercloud(command.Command):
answers['environments'].extend(args.environment_files)
args.environment_files = answers['environments']
def _update_parameters(self, args, stack):
parameters = {}
stack_is_new = stack is None
parameters['RootStackName'] = args.stack
if not args.skip_deploy_identifier:
parameters['DeployIdentifier'] = int(time.time())
else:
parameters['DeployIdentifier'] = ''
parameters['StackAction'] = 'CREATE' if stack_is_new else 'UPDATE'
param_args = (
('NtpServer', 'ntp_server'),
)
@ -1074,10 +1081,8 @@ class DeployOvercloud(command.Command):
utils.check_deprecated_service_is_enabled(
parsed_args.environment_files)
self._update_args_from_answers_file(parsed_args)
stack = utils.get_stack(self.orchestration_client, parsed_args.stack)
self._update_parameters(parsed_args, stack)
stack_create = stack is None
if stack_create:
self.log.info("No stack found, will be doing a stack create")