Disable clean_step if config option is set to 0
Disabling erase_devices clean_step in agent_ilo driver doesn't work even though the configuration option is updated to 0. Change-Id: I72501793b9a0d384555bec2bbe2ddfdb2f1c2c2f Closes-Bug:#1448103
This commit is contained in:
parent
48da9f0058
commit
f68a60ab06
@ -566,7 +566,7 @@ class IloVirtualMediaAgentDeploy(base.DeployInterface):
|
|||||||
:returns: A list of clean step dictionaries
|
:returns: A list of clean step dictionaries
|
||||||
"""
|
"""
|
||||||
steps = deploy_utils.agent_get_clean_steps(task)
|
steps = deploy_utils.agent_get_clean_steps(task)
|
||||||
if CONF.ilo.clean_priority_erase_devices:
|
if CONF.ilo.clean_priority_erase_devices is not None:
|
||||||
for step in steps:
|
for step in steps:
|
||||||
if (step.get('step') == 'erase_devices' and
|
if (step.get('step') == 'erase_devices' and
|
||||||
step.get('interface') == 'deploy'):
|
step.get('interface') == 'deploy'):
|
||||||
|
@ -733,6 +733,22 @@ class IloVirtualMediaAgentDeployTestCase(db_base.DbTestCase):
|
|||||||
self.assertEqual(step[0].get('priority'),
|
self.assertEqual(step[0].get('priority'),
|
||||||
CONF.ilo.clean_priority_erase_devices)
|
CONF.ilo.clean_priority_erase_devices)
|
||||||
|
|
||||||
|
@mock.patch.object(deploy_utils, 'agent_get_clean_steps', autospec=True)
|
||||||
|
def test_get_clean_steps_erase_devices_disable(self, get_clean_step_mock):
|
||||||
|
self.config(clean_priority_erase_devices=0, group='ilo')
|
||||||
|
get_clean_step_mock.return_value = [{
|
||||||
|
'step': 'erase_devices',
|
||||||
|
'priority': 10,
|
||||||
|
'interface': 'deploy',
|
||||||
|
'reboot_requested': False
|
||||||
|
}]
|
||||||
|
with task_manager.acquire(self.context, self.node.uuid,
|
||||||
|
shared=False) as task:
|
||||||
|
step = task.driver.deploy.get_clean_steps(task)
|
||||||
|
get_clean_step_mock.assert_called_once_with(task)
|
||||||
|
self.assertEqual(step[0].get('priority'),
|
||||||
|
CONF.ilo.clean_priority_erase_devices)
|
||||||
|
|
||||||
@mock.patch.object(deploy_utils, 'agent_get_clean_steps', autospec=True)
|
@mock.patch.object(deploy_utils, 'agent_get_clean_steps', autospec=True)
|
||||||
def test_get_clean_steps_without_conf_option(self, get_clean_step_mock):
|
def test_get_clean_steps_without_conf_option(self, get_clean_step_mock):
|
||||||
get_clean_step_mock.return_value = [{
|
get_clean_step_mock.return_value = [{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user