diff --git a/ironic/drivers/modules/ilo/deploy.py b/ironic/drivers/modules/ilo/deploy.py index 86dc0c7297..5f901184e1 100644 --- a/ironic/drivers/modules/ilo/deploy.py +++ b/ironic/drivers/modules/ilo/deploy.py @@ -566,7 +566,7 @@ class IloVirtualMediaAgentDeploy(base.DeployInterface): :returns: A list of clean step dictionaries """ 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: if (step.get('step') == 'erase_devices' and step.get('interface') == 'deploy'): diff --git a/ironic/tests/drivers/ilo/test_deploy.py b/ironic/tests/drivers/ilo/test_deploy.py index 669a186225..83793fd958 100644 --- a/ironic/tests/drivers/ilo/test_deploy.py +++ b/ironic/tests/drivers/ilo/test_deploy.py @@ -733,6 +733,22 @@ class IloVirtualMediaAgentDeployTestCase(db_base.DbTestCase): self.assertEqual(step[0].get('priority'), 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) def test_get_clean_steps_without_conf_option(self, get_clean_step_mock): get_clean_step_mock.return_value = [{