DPDK derive params network config validation
This change is to fail the action and provide validation message when get_network_config action is unable to determine the network config for any role. Change-Id: Ieeaf6e74360b782990633385771cd3d3a46152c8 Closes-Bug: #1714474
This commit is contained in:
parent
7f3e8df345
commit
bfcaf0a1ec
@ -567,9 +567,13 @@ class GetNetworkConfigAction(templates.ProcessTemplatesAction):
|
|||||||
}
|
}
|
||||||
orc = self.get_orchestration_client(context)
|
orc = self.get_orchestration_client(context)
|
||||||
preview_data = orc.stacks.preview(**fields)
|
preview_data = orc.stacks.preview(**fields)
|
||||||
result = self.get_network_config(preview_data, container_temp,
|
try:
|
||||||
self.role_name)
|
result = self.get_network_config(preview_data, container_temp,
|
||||||
return result
|
self.role_name)
|
||||||
|
return result
|
||||||
|
except exception.DeriveParamsError as err:
|
||||||
|
LOG.exception('Derive Params Error: %s' % err)
|
||||||
|
return actions.Result(error=str(err))
|
||||||
|
|
||||||
def get_network_config(self, preview_data, stack_name, role_name):
|
def get_network_config(self, preview_data, stack_name, role_name):
|
||||||
result = None
|
result = None
|
||||||
@ -588,6 +592,12 @@ class GetNetworkConfigAction(templates.ProcessTemplatesAction):
|
|||||||
if net_config:
|
if net_config:
|
||||||
result = json.loads(net_config)
|
result = json.loads(net_config)
|
||||||
break
|
break
|
||||||
|
|
||||||
|
if not result:
|
||||||
|
err_msg = ("Unable to determine network config for role '%s'."
|
||||||
|
% self.role_name)
|
||||||
|
raise exception.DeriveParamsError(err_msg)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def process_preview_list(self, res, stack_name, role_name):
|
def process_preview_list(self, res, stack_name, role_name):
|
||||||
|
@ -1128,7 +1128,7 @@ class GetNetworkConfigActionTest(base.TestCase):
|
|||||||
action = parameters.GetNetworkConfigAction(container='overcloud',
|
action = parameters.GetNetworkConfigAction(container='overcloud',
|
||||||
role_name='Compute')
|
role_name='Compute')
|
||||||
result = action.run(mock_ctx)
|
result = action.run(mock_ctx)
|
||||||
self.assertIsNone(result)
|
self.assertTrue(result.is_error())
|
||||||
mock_heat.stacks.preview.assert_called_once_with(
|
mock_heat.stacks.preview.assert_called_once_with(
|
||||||
environment={},
|
environment={},
|
||||||
files={},
|
files={},
|
||||||
|
Loading…
Reference in New Issue
Block a user