From eb8765149627f83384e8e639882c86c71b21b112 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Mon, 27 Jul 2020 17:54:50 +0200 Subject: [PATCH] Allow erase_devices_metadata to be used as a deploy step Change-Id: I75f156dd76b0e3aaa1592ba24fe42fb2a7057cc8 Story: #2006963 --- ironic_python_agent/hardware.py | 6 ++++++ ironic_python_agent/tests/unit/test_hardware.py | 8 ++++++++ .../notes/erase-deploy-step-3e952fa863bca908.yaml | 5 +++++ 3 files changed, 19 insertions(+) create mode 100644 releasenotes/notes/erase-deploy-step-3e952fa863bca908.yaml diff --git a/ironic_python_agent/hardware.py b/ironic_python_agent/hardware.py index ea06bb401..00ccb9300 100644 --- a/ironic_python_agent/hardware.py +++ b/ironic_python_agent/hardware.py @@ -1583,6 +1583,12 @@ class GenericHardwareManager(HardwareManager): def get_deploy_steps(self, node, ports): return [ + { + 'step': 'erase_devices_metadata', + 'priority': 0, + 'interface': 'deploy', + 'reboot_requested': False, + }, { 'step': 'apply_configuration', 'priority': 0, diff --git a/ironic_python_agent/tests/unit/test_hardware.py b/ironic_python_agent/tests/unit/test_hardware.py index 63ccb1d08..c2516bd0d 100644 --- a/ironic_python_agent/tests/unit/test_hardware.py +++ b/ironic_python_agent/tests/unit/test_hardware.py @@ -881,6 +881,14 @@ class TestGenericHardwareManager(base.IronicAgentTest): clean_steps = self.hardware.get_clean_steps(self.node, []) self.assertEqual(expected_clean_steps, clean_steps) + def test_clean_steps_exist(self): + for step in self.hardware.get_clean_steps(self.node, []): + getattr(self.hardware, step['step']) + + def test_deploy_steps_exist(self): + for step in self.hardware.get_deploy_steps(self.node, []): + getattr(self.hardware, step['step']) + @mock.patch('binascii.hexlify', autospec=True) @mock.patch('ironic_python_agent.netutils.get_lldp_info', autospec=True) def test_collect_lldp_data(self, mock_lldp_info, mock_hexlify): diff --git a/releasenotes/notes/erase-deploy-step-3e952fa863bca908.yaml b/releasenotes/notes/erase-deploy-step-3e952fa863bca908.yaml new file mode 100644 index 000000000..971e30676 --- /dev/null +++ b/releasenotes/notes/erase-deploy-step-3e952fa863bca908.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + The ``deploy.erase_devices_metadata`` clean step can now also be used as + a deploy step.