Merge "Error if deployment fails"

This commit is contained in:
Zuul 2018-05-16 02:32:37 +00:00 committed by Gerrit Code Review
commit 9a926ae699
2 changed files with 15 additions and 2 deletions

View File

@ -372,7 +372,7 @@ class TestDeployUndercloud(TestPluginV1):
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
'_create_install_artifact', return_value='/tmp/foo.tar.bzip2')
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
'_launch_ansible_deploy')
'_launch_ansible_deploy', return_value=0)
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
'_cleanup_working_dirs')
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
@ -438,3 +438,15 @@ class TestDeployUndercloud(TestPluginV1):
'--output-dir', '/my'], [])
self.assertRaises(exceptions.DeploymentError,
self.cmd.take_action, parsed_args)
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy._standalone_deploy',
return_value=1)
def test_take_action_failure(self, mock_deploy):
parsed_args = self.check_parser(self.cmd,
['--local-ip', '127.0.0.1',
'--templates', '/tmp/thtroot',
'--stack', 'undercloud',
'--output-dir', '/my',
'--standalone'], [])
self.assertRaises(exceptions.DeploymentError,
self.cmd.take_action, parsed_args)

View File

@ -778,7 +778,8 @@ class Deploy(command.Command):
self.log.debug("take_action(%s)" % parsed_args)
if parsed_args.standalone:
self._standalone_deploy(parsed_args)
if self._standalone_deploy(parsed_args) != 0:
raise exceptions.DeploymentError('Deployment failed.')
else:
raise exceptions.DeploymentError('Non-standalone is currently not '
'supported')