Blame SOURCES/bz1298430-2-fence_cisco_ucs-Add-missing-as-off.patch

e4ffb1
From 0a34f115c378ed1791f2aceb5abdb0633c394d6f Mon Sep 17 00:00:00 2001
e4ffb1
From: Marek 'marx' Grac <mgrac@redhat.com>
e4ffb1
Date: Tue, 9 Feb 2016 09:49:01 +0100
e4ffb1
Subject: [PATCH 2/4] fence_cisco_ucs: Add --missing-as-off
e4ffb1
e4ffb1
---
e4ffb1
 fence/agents/cisco_ucs/fence_cisco_ucs.py | 10 ++++++++--
e4ffb1
 1 file changed, 8 insertions(+), 2 deletions(-)
e4ffb1
e4ffb1
diff --git a/fence/agents/cisco_ucs/fence_cisco_ucs.py b/fence/agents/cisco_ucs/fence_cisco_ucs.py
e4ffb1
index 260925e..08da566 100644
e4ffb1
--- a/fence/agents/cisco_ucs/fence_cisco_ucs.py
e4ffb1
+++ b/fence/agents/cisco_ucs/fence_cisco_ucs.py
e4ffb1
@@ -32,10 +32,16 @@ def get_power_status(conn, options):
e4ffb1
 
e4ffb1
 	result = RE_GET_PNDN.search(res)
e4ffb1
 	if result == None:
e4ffb1
-		fail(EC_STATUS)
e4ffb1
+		pndn = ""
e4ffb1
 	else:
e4ffb1
 		pndn = result.group(1)
e4ffb1
 
e4ffb1
+	if pndn.strip() == "":
e4ffb1
+		if "--missing-as-off" in options:
e4ffb1
+			return "off"
e4ffb1
+		else:
e4ffb1
+			fail(EC_STATUS)
e4ffb1
+
e4ffb1
 	res = send_command(options, "
e4ffb1
 			"\" inHierarchical=\"false\" dn=\"" + pndn +
e4ffb1
 			"\"/>", int(options["--shell-timeout"]))
e4ffb1
@@ -139,7 +145,7 @@ def logout():
e4ffb1
 
e4ffb1
 def main():
e4ffb1
 	global options_global
e4ffb1
-	device_opt = ["ipaddr", "login", "passwd", "ssl", "notls", "port", "web", "suborg"]
e4ffb1
+	device_opt = ["ipaddr", "login", "passwd", "ssl", "notls", "port", "web", "suborg", "missing_as_off"]
e4ffb1
 
e4ffb1
 	atexit.register(atexit_handler)
e4ffb1
 	atexit.register(logout)
e4ffb1
-- 
e4ffb1
2.4.3
e4ffb1