Merge "Show correct missing files when an error occurs"
This commit is contained in:
commit
2f81900ebc
|
@ -873,6 +873,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)
|
||||
|
|
|
@ -394,18 +394,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')
|
||||
|
|
Loading…
Reference in New Issue