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
(cherry picked from commit bfcaf0a1ec
)
This commit is contained in:
parent
98042040e2
commit
ead9d5d2b6
|
@ -567,9 +567,13 @@ class GetNetworkConfigAction(templates.ProcessTemplatesAction):
|
|||
}
|
||||
orc = self.get_orchestration_client(context)
|
||||
preview_data = orc.stacks.preview(**fields)
|
||||
result = self.get_network_config(preview_data, container_temp,
|
||||
self.role_name)
|
||||
return result
|
||||
try:
|
||||
result = self.get_network_config(preview_data, container_temp,
|
||||
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):
|
||||
result = None
|
||||
|
@ -588,6 +592,12 @@ class GetNetworkConfigAction(templates.ProcessTemplatesAction):
|
|||
if net_config:
|
||||
result = json.loads(net_config)
|
||||
break
|
||||
|
||||
if not result:
|
||||
err_msg = ("Unable to determine network config for role '%s'."
|
||||
% self.role_name)
|
||||
raise exception.DeriveParamsError(err_msg)
|
||||
|
||||
return result
|
||||
|
||||
def process_preview_list(self, res, stack_name, role_name):
|
||||
|
|
|
@ -1126,7 +1126,7 @@ class GetNetworkConfigActionTest(base.TestCase):
|
|||
action = parameters.GetNetworkConfigAction(container='overcloud',
|
||||
role_name='Compute')
|
||||
result = action.run(mock_ctx)
|
||||
self.assertIsNone(result)
|
||||
self.assertTrue(result.is_error())
|
||||
mock_heat.stacks.preview.assert_called_once_with(
|
||||
environment={},
|
||||
files={},
|
||||
|
|
Loading…
Reference in New Issue