From f759194ecd326935285dc1f7dbad6e36b2720fbe Mon Sep 17 00:00:00 2001 From: George Matthews Date: Mon, 16 Dec 2024 09:19:06 +0000 Subject: [PATCH] Fix hypervisor sensor Change current state to use the name of hypervisorstate enum as expected --- sensors/src/hypervisor_state_sensor.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sensors/src/hypervisor_state_sensor.py b/sensors/src/hypervisor_state_sensor.py index ed02db40..f3ff5c7a 100644 --- a/sensors/src/hypervisor_state_sensor.py +++ b/sensors/src/hypervisor_state_sensor.py @@ -46,11 +46,11 @@ def poll(self): name=hypervisor["hypervisor_name"] ) - if not prev_state == current_state: + if not prev_state == current_state.name: payload = { "hypervisor_name": hypervisor["hypervisor_name"], - "previous_state": prev_state, - "current_state": current_state, + "previous_state": prev_state.name, + "current_state": current_state.name, } self.sensor_service.dispatch( trigger="stackstorm_openstack.hypervisor.state_change", @@ -58,7 +58,7 @@ def poll(self): ) self.sensor_service.set_value( - name=hypervisor["hypervisor_name"], value=current_state + name=hypervisor["hypervisor_name"], value=current_state.name ) def cleanup(self):