From 88e85766c65b42e35644003cfcac6ffd42fcc8e9 Mon Sep 17 00:00:00 2001 From: Oliver Walsh Date: Thu, 17 May 2018 14:33:04 +0100 Subject: [PATCH] WOL driver - include POWER_OFF in supported power states The WakeOnLanPower class is designed to POWER_ON using WOL and log REBOOT/POWER_OFF operations as they require manual intervention. However the POWER_OFF state was mistakenly omitted from get_supported_power_states, which results in an error instead of a log entry. Introspection on tripleo fails as a result of this. Story: #2005292 Task: #30162 Change-Id: I34ee6da8600d6e6107f00732bf1c34c5b745b333 --- ironic_staging_drivers/tests/unit/wol/test_power.py | 9 ++++++++- ironic_staging_drivers/wol/power.py | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ironic_staging_drivers/tests/unit/wol/test_power.py b/ironic_staging_drivers/tests/unit/wol/test_power.py index 39d8e88..797bf6e 100644 --- a/ironic_staging_drivers/tests/unit/wol/test_power.py +++ b/ironic_staging_drivers/tests/unit/wol/test_power.py @@ -211,4 +211,11 @@ class WakeOnLanDriverTestCase(db_base.DbTestCase): with task_manager.acquire( self.context, self.node.uuid, shared=True) as task: pstate = task.driver.power.get_supported_power_states(task) - self.assertEqual([states.POWER_ON, states.REBOOT], pstate) + self.assertEqual( + [ + states.POWER_ON, + states.POWER_OFF, + states.REBOOT + ], + pstate + ) diff --git a/ironic_staging_drivers/wol/power.py b/ironic_staging_drivers/wol/power.py index 7b37604..5b6cfd7 100644 --- a/ironic_staging_drivers/wol/power.py +++ b/ironic_staging_drivers/wol/power.py @@ -198,4 +198,4 @@ class WakeOnLanPower(base.PowerInterface): :returns: A list with the supported power states defined in :mod:`ironic.common.states`. """ - return [states.POWER_ON, states.REBOOT] + return [states.POWER_ON, states.POWER_OFF, states.REBOOT]