diff --git a/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py b/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py index e5cd63859..d866dfe0d 100644 --- a/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py +++ b/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py @@ -886,6 +886,20 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud): '/fake/path', mock.ANY, mock.ANY, mock.ANY, mock.ANY, mock.ANY) + @mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.' + '_heat_deploy', autospec=True) + def test_try_overcloud_deploy_show_missing_file( + self, mock_heat_deploy_func): + mock_heat_deploy_func.side_effect = [ + six.moves.urllib.error.URLError('/fake/path not found') + for stack_file in constants.OVERCLOUD_YAML_NAMES] + try: + self.cmd._try_overcloud_deploy_with_compat_yaml( + '/fake/path', mock.ANY, mock.ANY, mock.ANY, + mock.ANY, mock.ANY) + except ValueError as value_error: + self.assertIn('/fake/path', str(value_error)) + @mock.patch('tripleoclient.utils.create_tempest_deployer_input', autospec=True) @mock.patch('tripleoclient.utils.create_overcloudrc', autospec=True) diff --git a/tripleoclient/v1/overcloud_deploy.py b/tripleoclient/v1/overcloud_deploy.py index 5dcd80e0b..6ed44ccca 100644 --- a/tripleoclient/v1/overcloud_deploy.py +++ b/tripleoclient/v1/overcloud_deploy.py @@ -402,18 +402,17 @@ class DeployOvercloud(command.Command): def _try_overcloud_deploy_with_compat_yaml(self, tht_root, stack, stack_name, parameters, environments, timeout): + messages = ['The following errors occurred:'] for overcloud_yaml_name in constants.OVERCLOUD_YAML_NAMES: overcloud_yaml = os.path.join(tht_root, overcloud_yaml_name) try: self._heat_deploy(stack, stack_name, overcloud_yaml, parameters, environments, timeout) - except six.moves.urllib.error.URLError: - pass + except six.moves.urllib.error.URLError as e: + messages.append(str(e.reason)) else: return - message = "The files {0} not found in the {1} directory".format( - constants.OVERCLOUD_YAML_NAMES, tht_root) - raise ValueError(message) + raise ValueError('\n'.join(messages)) def _is_tls_enabled(self, overcloud_endpoint): return overcloud_endpoint.startswith('https')