Blame SOURCES/bz1251491-none_as_state.patch

e4ffb1
From 76ddf8b54482ef4702abc35611cf1c0250c62dcd Mon Sep 17 00:00:00 2001
e4ffb1
From: Marek 'marx' Grac <mgrac@redhat.com>
e4ffb1
Date: Mon, 10 Aug 2015 13:17:07 +0200
e4ffb1
Subject: [PATCH] fencing: Fence library should work correctly also when power
e4ffb1
 state is None
e4ffb1
e4ffb1
Previously, valid states ON/OFF were accepted and all other values were mapped to UNKNOWN. But if value is None then
e4ffb1
it is not possible to do state.upper() and fencing fails.
e4ffb1
e4ffb1
Resolves: rhbz#1251491
e4ffb1
---
e4ffb1
 fence/agents/lib/fencing.py.py | 4 ++--
e4ffb1
 1 file changed, 2 insertions(+), 2 deletions(-)
e4ffb1
e4ffb1
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
e4ffb1
index fb7b77d..3a6e2ab 100644
e4ffb1
--- a/fence/agents/lib/fencing.py.py
e4ffb1
+++ b/fence/agents/lib/fencing.py.py
e4ffb1
@@ -951,9 +951,9 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list=None,
e4ffb1
 				## keys can be numbers (port numbers) or strings (names of VM)
e4ffb1
 				for outlet_id in outlets.keys():
e4ffb1
 					(alias, status) = outlets[outlet_id]
e4ffb1
-					status = status.upper()
e4ffb1
-					if not status in ["ON", "OFF"]:
e4ffb1
+					if status is None or (not status.upper() in ["ON", "OFF"]):
e4ffb1
 						status = "UNKNOWN"
e4ffb1
+						status = status.upper()
e4ffb1
 
e4ffb1
 					if options["--action"] == "list":
e4ffb1
 						print outlet_id + options["--separator"] + alias
e4ffb1
-- 
e4ffb1
1.9.3
e4ffb1