Blame SOURCES/bz1251491-none_as_state.patch

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