Merge "Initially set rc to 0, not 1"

This commit is contained in:
Zuul 2020-07-29 04:23:38 +00:00 committed by Gerrit Code Review
commit bc25c1ce90
2 changed files with 64 additions and 1 deletions

View File

@ -1042,3 +1042,66 @@ class TestDeployUndercloud(TestPluginV1):
'--standalone', '--standalone',
'--force-stack-create', '--force-stack-create',
'--force-stack-update'], []) '--force-stack-update'], [])
@mock.patch('os.path.exists', return_value=True)
@mock.patch('os.chdir')
@mock.patch('tripleoclient.utils.reset_cmdline')
@mock.patch('tripleoclient.utils.copy_clouds_yaml')
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
'_download_stack_outputs')
@mock.patch('tripleo_common.actions.ansible.'
'write_default_ansible_cfg')
# TODO(cjeanner) drop once we have proper oslo.privsep
@mock.patch('os.chmod')
# TODO(cjeanner) drop once we have proper oslo.privsep
@mock.patch('os.mkdir')
@mock.patch('six.moves.builtins.open')
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
'_populate_templates_dir')
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
'_create_install_artifact', return_value='/tmp/foo.tar.bzip2')
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
'_cleanup_working_dirs')
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
'_create_working_dirs')
@mock.patch('tripleoclient.utils.wait_api_port_ready',
autospec=True)
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
'_deploy_tripleo_heat_templates', autospec=True,
return_value='undercloud, 0')
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
'_download_ansible_playbooks', autospec=True,
return_value='/foo')
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
'_launch_heat')
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
'_kill_heat')
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
'_configure_puppet')
@mock.patch('os.geteuid', return_value=0)
@mock.patch('os.environ', return_value='CREATE_COMPLETE')
@mock.patch('tripleoclient.utils.wait_for_stack_ready', return_value=True)
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
'_set_default_plan')
def test_standalone_deploy_rc_output_only(
self,
mock_def_plan, mock_poll,
mock_environ, mock_geteuid, mock_puppet,
mock_killheat, mock_launchheat,
mock_download, mock_tht,
mock_wait_for_port, mock_createdirs,
mock_cleanupdirs, mock_tarball,
mock_templates_dir, mock_open, mock_os,
mock_chmod, mock_ac,
mock_outputs, mock_copy, mock_cmdline,
mock_chdir, mock_file_exists):
parsed_args = self.check_parser(self.cmd,
['--local-ip', '127.0.0.1',
'--templates', '/tmp/thtroot',
'--stack', 'undercloud',
'--output-dir', '/my',
'--output-only',
'--standalone'], [])
rc = self.cmd.take_action(parsed_args)
self.assertEqual(None, rc)

View File

@ -1220,7 +1220,7 @@ class Deploy(command.Command):
# Set default plan if not specified by user # Set default plan if not specified by user
self._set_default_plan() self._set_default_plan()
rc = 1 rc = 0
try: try:
# NOTE(bogdando): Look for the unique virtual update mark matching # NOTE(bogdando): Look for the unique virtual update mark matching
# the heat stack name we are going to create below. If found the # the heat stack name we are going to create below. If found the