Add --config-download-only

A new CLI argument, --config-download-only, has been added which can be
used to skip the stack create/update and only run the config-download
workflow to apply the software configuration.

Change-Id: I6f3e8a943d49fea65e855d76e3c3d56f9eb8e41b
This commit is contained in:
James Slagle 2018-05-30 14:19:24 -04:00
parent 4ad7dff959
commit b4b2fe24d0
3 changed files with 53 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
features:
- A new CLI argument, --config-download-only, has been added which can be
used to skip the stack create/update and only run the config-download
workflow to apply the software configuration.

View File

@ -1860,6 +1860,44 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
self.assertTrue(mock_get_overcloud_hosts.called) self.assertTrue(mock_get_overcloud_hosts.called)
self.assertTrue(mock_config_download.called) self.assertTrue(mock_config_download.called)
@mock.patch('tripleoclient.workflows.deployment.get_overcloud_hosts')
@mock.patch('tripleoclient.workflows.deployment.enable_ssh_admin')
@mock.patch('tripleoclient.workflows.deployment.get_horizon_url',
autospec=True)
@mock.patch('tripleoclient.workflows.deployment.config_download')
@mock.patch('tripleoclient.utils.create_tempest_deployer_input',
autospec=True)
@mock.patch('tripleoclient.utils.get_overcloud_endpoint', autospec=True)
@mock.patch('tripleoclient.utils.write_overcloudrc', autospec=True)
@mock.patch('tripleoclient.workflows.deployment.overcloudrc',
autospec=True)
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
'_deploy_tripleo_heat_templates_tmpdir', autospec=True)
def test_config_download_only(
self, mock_deploy_tmpdir,
mock_overcloudrc, mock_write_overcloudrc,
mock_overcloud_endpoint,
mock_create_tempest_deployer_input,
mock_config_download, mock_get_horizon_url,
mock_enable_ssh_admin,
mock_get_overcloud_hosts):
clients = self.app.client_manager
orchestration_client = clients.orchestration
orchestration_client.stacks.get.return_value = mock.Mock()
arglist = ['--templates', '--config-download-only']
verifylist = [
('templates', '/usr/share/openstack-tripleo-heat-templates/'),
('config_download_only', True),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.cmd.take_action(parsed_args)
self.assertFalse(mock_deploy_tmpdir.called)
self.assertTrue(mock_enable_ssh_admin.called)
self.assertTrue(mock_get_overcloud_hosts.called)
self.assertTrue(mock_config_download.called)
def test_download_missing_files_from_plan(self): def test_download_missing_files_from_plan(self):
# Restore the real function so we don't accidentally call the mock # Restore the real function so we don't accidentally call the mock
self.cmd._download_missing_files_from_plan = self.real_download_missing self.cmd._download_missing_files_from_plan = self.real_download_missing

View File

@ -805,6 +805,14 @@ class DeployOvercloud(command.Command):
'the stack and associated OpenStack resources. No ' 'the stack and associated OpenStack resources. No '
'software configuration will be applied.') 'software configuration will be applied.')
) )
parser.add_argument(
'--config-download-only',
action='store_true',
default=False,
help=_('Disable the stack create/update, and only run the '
'config-download workflow to apply the software '
'configuration.')
)
parser.add_argument( parser.add_argument(
'--output-dir', '--output-dir',
action='store', action='store',
@ -891,6 +899,7 @@ class DeployOvercloud(command.Command):
print("Validation Finished") print("Validation Finished")
return return
if not parsed_args.config_download_only:
self._deploy_tripleo_heat_templates_tmpdir(stack, parsed_args) self._deploy_tripleo_heat_templates_tmpdir(stack, parsed_args)
# Get a new copy of the stack after stack update/create. If it was # Get a new copy of the stack after stack update/create. If it was