From 3b2afd951bd2b39d9aca8aa72134e32f29a46215 Mon Sep 17 00:00:00 2001 From: James Slagle Date: Wed, 4 Jan 2017 09:54:21 -0500 Subject: [PATCH] Add --disable-validations The validations run by tripleoclient do not need to be run at all when using split stack (multinode, deployed-server, etc). While we already have --validation-errors-nonfatal, you still see the log messages about the failed validations, which can create end user confusion. The --disable-validations argument will disable running the validations completely. Change-Id: I61d5ead3d8eaf165bba6d277adbe3a1d84d1e5e7 Partially-implements: blueprint split-stack-software-configuration --- .../overcloud_deploy/test_overcloud_deploy.py | 46 +++++++++++++++++++ tripleoclient/v1/overcloud_deploy.py | 46 +++++++++++-------- 2 files changed, 73 insertions(+), 19 deletions(-) diff --git a/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py b/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py index ba9e88d80..5e22273fe 100644 --- a/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py +++ b/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py @@ -1287,3 +1287,49 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud): self.assertRaises(exceptions.StackInProgress, self.cmd.take_action, parsed_args) + + @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_disable_validations_true( + self, mock_deploy_tmpdir, + mock_overcloudrc, mock_write_overcloudrc, + mock_overcloud_endpoint): + clients = self.app.client_manager + orchestration_client = clients.orchestration + orchestration_client.stacks.get.return_value = mock.Mock() + + arglist = ['--templates', '--disable-validations'] + verifylist = [ + ('templates', '/usr/share/openstack-tripleo-heat-templates/'), + ] + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + + self.cmd.take_action(parsed_args) + self.assertNotCalled(self.cmd._predeploy_verify_capabilities) + + @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_disable_validations_false( + self, mock_deploy_tmpdir, + mock_overcloudrc, mock_write_overcloudrc, + mock_overcloud_endpoint): + clients = self.app.client_manager + orchestration_client = clients.orchestration + orchestration_client.stacks.get.return_value = mock.Mock() + + arglist = ['--templates'] + verifylist = [ + ('templates', '/usr/share/openstack-tripleo-heat-templates/'), + ] + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + + self.cmd.take_action(parsed_args) + self.assertTrue(self.cmd._predeploy_verify_capabilities.called) diff --git a/tripleoclient/v1/overcloud_deploy.py b/tripleoclient/v1/overcloud_deploy.py index b245fb4e1..297dec067 100644 --- a/tripleoclient/v1/overcloud_deploy.py +++ b/tripleoclient/v1/overcloud_deploy.py @@ -966,6 +966,11 @@ class DeployOvercloud(command.Command): help=_('Exit if there are warnings from the configuration ' 'pre-checks.') ) + parser.add_argument( + '--disable-validations', + action='store_true', + default=False, + help=_('Disable the predeployment validations entirely.')) parser.add_argument( '--dry-run', action='store_true', @@ -1049,25 +1054,28 @@ class DeployOvercloud(command.Command): parameters = self._update_parameters( parsed_args, clients.network, stack) - errors, warnings = self._predeploy_verify_capabilities( - stack, parameters, parsed_args) - if errors > 0: - self.log.error( - "Configuration has %d errors, fix them before proceeding. " - "Ignoring these errors is likely to lead to a failed deploy.", - errors) - if parsed_args.validation_warnings_fatal or \ - parsed_args.validation_errors_fatal: - return - if warnings > 0: - self.log.error( - "Configuration has %d warnings, fix them before proceeding. ", - warnings) - if parsed_args.validation_warnings_fatal: - return - else: - self.log.info("SUCCESS: No warnings or errors in deploy " - "configuration, proceeding.") + if not parsed_args.disable_validations: + errors, warnings = self._predeploy_verify_capabilities( + stack, parameters, parsed_args) + if errors > 0: + self.log.error( + "Configuration has %d errors, fix them before " + "proceeding. Ignoring these errors is likely to lead to " + "a failed deploy.", + errors) + if parsed_args.validation_warnings_fatal or \ + parsed_args.validation_errors_fatal: + return + if warnings > 0: + self.log.error( + "Configuration has %d warnings, fix them before " + "proceeding.", + warnings) + if parsed_args.validation_warnings_fatal: + return + else: + self.log.info("SUCCESS: No warnings or errors in deploy " + "configuration, proceeding.") stack_create = stack is None if stack_create: