Create DeployIdentifier for standalone
There is a bunch of update logic in the framework that expects that a DeployIdentifier will be set on updates in order to function correctly. This change adds the generation of a DeployIdentifier to our update logic to ensure that we are passing it to the deployment on updates. Change-Id: Icf9a8f1c8049e46cc33541c5c40fc0d706a5869a Closes-Bug: #1796421
This commit is contained in:
parent
01eca26528
commit
5d4cebf395
|
@ -392,6 +392,7 @@ class TestDeployUndercloud(TestPluginV1):
|
|||
env_files)
|
||||
self.assertEqual(expected, results)
|
||||
|
||||
@mock.patch('time.time', return_value=123)
|
||||
@mock.patch('yaml.safe_load', return_value={}, autospec=True)
|
||||
@mock.patch('yaml.safe_dump', autospec=True)
|
||||
@mock.patch('os.path.isfile', return_value=True)
|
||||
|
@ -409,7 +410,7 @@ class TestDeployUndercloud(TestPluginV1):
|
|||
def test_setup_heat_environments_dropin(
|
||||
self, mock_run, mock_paths, mock_norm, mock_update_pass_env,
|
||||
mock_process_hiera, mock_open, mock_os, mock_yaml_dump,
|
||||
mock_yaml_load):
|
||||
mock_yaml_load, mock_time):
|
||||
|
||||
parsed_args = self.check_parser(self.cmd,
|
||||
['--local-ip', '127.0.0.1/8',
|
||||
|
@ -427,6 +428,7 @@ class TestDeployUndercloud(TestPluginV1):
|
|||
# unpack the dump yaml calls to verify if the produced stack update
|
||||
# dropin matches our expectations
|
||||
found_dropin = False
|
||||
found_identifier = False
|
||||
for call in mock_yaml_dump.call_args_list:
|
||||
args, kwargs = call
|
||||
for a in args:
|
||||
|
@ -436,7 +438,13 @@ class TestDeployUndercloud(TestPluginV1):
|
|||
self.assertTrue(
|
||||
a['parameter_defaults']['StackAction'] == 'UPDATE')
|
||||
found_dropin = True
|
||||
if a.get('parameter_defaults', {}).get('DeployIdentifier',
|
||||
None):
|
||||
self.assertTrue(
|
||||
a['parameter_defaults']['DeployIdentifier'] == 123)
|
||||
found_identifier = True
|
||||
self.assertTrue(found_dropin)
|
||||
self.assertTrue(found_identifier)
|
||||
|
||||
@mock.patch('heatclient.common.template_utils.'
|
||||
'process_environment_and_files', return_value=({}, {}),
|
||||
|
|
|
@ -27,6 +27,7 @@ import subprocess
|
|||
import sys
|
||||
import tarfile
|
||||
import tempfile
|
||||
import time
|
||||
import traceback
|
||||
import yaml
|
||||
|
||||
|
@ -652,7 +653,9 @@ class Deploy(command.Command):
|
|||
parsed_args.stack)
|
||||
with open(stack_vstate_dropin, 'w') as dropin_file:
|
||||
yaml.safe_dump(
|
||||
{'parameter_defaults': {'StackAction': self.stack_action}},
|
||||
{'parameter_defaults': {
|
||||
'StackAction': self.stack_action,
|
||||
'DeployIdentifier': int(time.time())}},
|
||||
dropin_file, default_flow_style=False)
|
||||
environments.append(stack_vstate_dropin)
|
||||
|
||||
|
|
Loading…
Reference in New Issue