fence-agents: master - fencing: Fix problems when fence agent do not have --plug / -n

Marek GrĂ¡c marx at fedoraproject.org
Mon Jun 9 13:38:56 UTC 2014


Gitweb:        http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=c783ce59939e482525eca82bdcfbc0dcf63043d3
Commit:        c783ce59939e482525eca82bdcfbc0dcf63043d3
Parent:        1b5cc47b0fa7dc806c6a30d9296cf5be488a1518
Author:        Marek 'marx' Grac <mgrac at redhat.com>
AuthorDate:    Mon Jun 9 15:22:49 2014 +0200
Committer:     Marek 'marx' Grac <mgrac at redhat.com>
CommitterDate: Mon Jun 9 15:22:49 2014 +0200

fencing: Fix problems when fence agent do not have --plug / -n

Found during tests on fence_dummy
---
 fence/agents/lib/fencing.py.py |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 431b363..5084f24 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -785,8 +785,9 @@ def check_input(device_opt, opt):
 ######
 def get_multi_power_fn(tn, options, get_power_fn):
 	status = "off"
+	plugs = options["--plugs"] if options.has_key("--plugs") else [""]
 
-	for plug in options["--plugs"]:
+	for plug in plugs:
 		try:
 			options["--uuid"] = str(uuid.UUID(plug))
 		except ValueError:
@@ -802,8 +803,10 @@ def get_multi_power_fn(tn, options, get_power_fn):
 	return status
 
 def set_multi_power_fn(tn, options, set_power_fn, get_power_fn, retry_attempts = 1):
-	for _ in range(1, retry_attempts):
-		for plug in options["--plugs"]:
+	plugs = options["--plugs"] if options.has_key("--plugs") else [""]
+
+	for _ in range(retry_attempts):
+		for plug in plugs:
 			try:
 				options["--uuid"] = str(uuid.UUID(plug))
 			except ValueError:


More information about the cluster-commits mailing list