Write breakpoint cleanup env to swift

To be consistent with the other parameters/registration environment
write this to swift, such that we can move to server side merging
of environments in future.

Change-Id: I11f31ec3a356b32de34da1b128b6ec776550b5c5
Partial-Bug: #1635409
This commit is contained in:
Steven Hardy 2017-03-27 18:36:14 +01:00
parent 9bb593b859
commit 39293a7b17
2 changed files with 27 additions and 2 deletions

View File

@ -925,6 +925,13 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_get_template_contents.return_value = [{}, "template"]
wait_for_stack_ready_mock.return_value = True
bp_cleanup_env = {'resource_registry': {'Cleanup': 'OS::Heat::None'}}
def _fake_bp_cleanup(env):
env.update(bp_cleanup_env)
mock_breakpoints_cleanup.side_effect = _fake_bp_cleanup
clients = self.app.client_manager
orchestration_client = clients.orchestration
orchestration_client.stacks.get.return_value = fakes.create_tht_stack()
@ -950,7 +957,8 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
self.cmd.take_action(parsed_args)
user_env = {
'resource_registry': {'Test': 'OS::Heat::None'}}
'resource_registry': {'Test': 'OS::Heat::None',
'Cleanup': 'OS::Heat::None'}}
parameters_env = {
'parameter_defaults': {
'StackAction': 'UPDATE',
@ -973,6 +981,11 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
'tripleoclient-registration-parameters.yaml',
yaml.safe_dump(reg_env,
default_flow_style=False)),
mock.call('overcloud',
'user-environments/'
'tripleoclient-breakpoint-cleanup.yaml',
yaml.safe_dump(bp_cleanup_env,
default_flow_style=False)),
mock.call('overcloud',
'user-environment.yaml',
yaml.safe_dump(user_env,

View File

@ -107,6 +107,16 @@ class DeployOvercloud(command.Command):
return parameters
def _create_breakpoint_cleanup_env(self, tht_root, container_name):
bp_env = {}
update.add_breakpoints_cleanup_into_env(bp_env)
env_path, swift_path = self._write_user_environment(
bp_env,
'tripleoclient-breakpoint-cleanup.yaml',
tht_root,
container_name)
return bp_env
def _create_registration_env(self, args, tht_root):
user_tht_root = args.templates
registry = os.path.join(
@ -478,7 +488,9 @@ class DeployOvercloud(command.Command):
template_utils.deep_update(env, localenv)
if stack:
update.add_breakpoints_cleanup_into_env(env)
bp_cleanup = self._create_breakpoint_cleanup_env(
tht_root, parsed_args.stack)
template_utils.deep_update(env, bp_cleanup)
# FIXME(shardy) It'd be better to validate this via mistral
# e.g part of the plan create/update workflow