Merge "Disable clean_step if config option is set to 0"

This commit is contained in:
Jenkins 2015-04-27 02:55:48 +00:00 committed by Gerrit Code Review
commit ca5e89d1ed
2 changed files with 17 additions and 1 deletions

View File

@ -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'):

View File

@ -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 = [{