Merge "Update prepare using an environment file"

This commit is contained in:
Zuul 2018-04-17 11:53:51 +00:00 committed by Gerrit Code Review
commit 90830a7381
3 changed files with 28 additions and 10 deletions

View File

@ -51,5 +51,7 @@ MAJOR_UPGRADE_PLAYBOOKS = ["upgrade_steps_playbook.yaml",
MAJOR_UPGRADE_SKIP_TAGS = ['validation', 'pre-upgrade']
# upgrade environment files expected by the client in the --templates
# tripleo-heat-templates default above $TRIPLEO_HEAT_TEMPLATES
UPDATE_PREPARE_ENV = "environments/lifecycle/update-prepare.yaml"
UPDATE_CONVERGE_ENV = "environments/lifecycle/update-converge.yaml"
UPGRADE_PREPARE_ENV = "environments/lifecycle/upgrade-prepare.yaml"
UPGRADE_CONVERGE_ENV = "environments/lifecycle/upgrade-converge.yaml"

View File

@ -66,14 +66,18 @@ class TestOvercloudUpdatePrepare(fakes.TestOvercloudUpdatePrepare):
]
parsed_args = self.check_parser(self.cmd, argslist, verifylist)
self.cmd.take_action(parsed_args)
mock_update.assert_called_once_with(
self.app.client_manager,
container='mystack',
container_registry={'fake_container': 'fake_value'},
ceph_ansible_playbook='/usr/share/ceph-ansible'
'/site-docker.yml.sample'
)
with mock.patch('os.path.exists') as mock_exists, \
mock.patch('os.path.isfile') as mock_isfile:
mock_exists.return_value = True
mock_isfile.return_value = True
self.cmd.take_action(parsed_args)
mock_update.assert_called_once_with(
self.app.client_manager,
container='mystack',
container_registry={'fake_container': 'fake_value'},
ceph_ansible_playbook='/usr/share/ceph-ansible'
'/site-docker.yml.sample'
)
@mock.patch('tripleoclient.workflows.package_update.update',
autospec=True)
@ -97,8 +101,12 @@ class TestOvercloudUpdatePrepare(fakes.TestOvercloudUpdatePrepare):
]
parsed_args = self.check_parser(self.cmd, argslist, verifylist)
self.assertRaises(exceptions.DeploymentError,
self.cmd.take_action, parsed_args)
with mock.patch('os.path.exists') as mock_exists, \
mock.patch('os.path.isfile') as mock_isfile:
mock_exists.return_value = True
mock_isfile.return_value = True
self.assertRaises(exceptions.DeploymentError,
self.cmd.take_action, parsed_args)
class TestOvercloudUpdateRun(fakes.TestOvercloudUpdateRun):

View File

@ -82,6 +82,14 @@ class UpdatePrepare(DeployOvercloud):
# update_plan_only. The heat stack update is done by the
# packag_update mistral action
parsed_args.update_plan_only = True
# Add the upgrade-prepare.yaml environment to set noops etc
templates_dir = (parsed_args.templates or
constants.TRIPLEO_HEAT_TEMPLATES)
parsed_args.environment_files = oooutils.prepend_environment(
parsed_args.environment_files, templates_dir,
constants.UPDATE_PREPARE_ENV)
super(UpdatePrepare, self).take_action(parsed_args)
package_update.update(clients, container=stack_name,
container_registry=registry,