Merge "Add --disable-validations"
This commit is contained in:
@@ -1276,3 +1276,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)
|
||||
|
||||
@@ -975,6 +975,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',
|
||||
@@ -1058,19 +1063,22 @@ class DeployOvercloud(command.Command):
|
||||
parameters = self._update_parameters(
|
||||
parsed_args, clients.network, stack)
|
||||
|
||||
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.",
|
||||
"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. ",
|
||||
"Configuration has %d warnings, fix them before "
|
||||
"proceeding.",
|
||||
warnings)
|
||||
if parsed_args.validation_warnings_fatal:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user