cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH 01/15] [cleanup] Add missing spaces and fix tab/spaces indentation
@ 2014-04-02 11:52 Marek 'marx' Grac
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 02/15] [cleanup] Proper import of atexit Marek 'marx' Grac
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: Marek 'marx' Grac @ 2014-04-02 11:52 UTC (permalink / raw)
  To: cluster-devel.redhat.com

---
 fence/agents/alom/fence_alom.py                 |   8 +-
 fence/agents/amt/fence_amt.py                   | 202 +++++++++--------
 fence/agents/apc/fence_apc.py                   |  18 +-
 fence/agents/apc_snmp/fence_apc_snmp.py         |  18 +-
 fence/agents/bladecenter/fence_bladecenter.py   |   8 +-
 fence/agents/brocade/fence_brocade.py           |   6 +-
 fence/agents/cisco_mds/fence_cisco_mds.py       |   4 +-
 fence/agents/cisco_ucs/fence_cisco_ucs.py       |  10 +-
 fence/agents/drac/fence_drac.py                 |   8 +-
 fence/agents/drac5/fence_drac5.py               |  14 +-
 fence/agents/dummy/fence_dummy.py               |   6 +-
 fence/agents/eps/fence_eps.py                   |   6 +-
 fence/agents/hds_cb/fence_hds_cb.py             |   7 +-
 fence/agents/hpblade/fence_hpblade.py           |   8 +-
 fence/agents/ifmib/fence_ifmib.py               |   2 +-
 fence/agents/ilo/fence_ilo.py                   |   4 +-
 fence/agents/ilo_mp/fence_ilo_mp.py             |  12 +-
 fence/agents/intelmodular/fence_intelmodular.py |   2 +-
 fence/agents/ipmilan/fence_ipmilan.py           | 274 ++++++++++++------------
 fence/agents/ldom/fence_ldom.py                 |  21 +-
 fence/agents/lib/check_used_options.py          |   2 +-
 fence/agents/lib/fencing.py.py                  |  64 +++---
 fence/agents/lpar/fence_lpar.py                 |  18 +-
 fence/agents/ovh/fence_ovh.py                   |  18 +-
 fence/agents/rhevm/fence_rhevm.py               |   6 +-
 fence/agents/rsa/fence_rsa.py                   |   6 +-
 fence/agents/rsb/fence_rsb.py                   |   6 +-
 fence/agents/sanbox2/fence_sanbox2.py           |   6 +-
 fence/agents/vmware/fence_vmware.py             |   2 +-
 fence/agents/vmware_soap/fence_vmware_soap.py   |  16 +-
 fence/agents/wti/fence_wti.py                   |  24 +--
 fence/agents/xenapi/fence_xenapi.py             |  19 +-
 32 files changed, 409 insertions(+), 416 deletions(-)

diff --git a/fence/agents/alom/fence_alom.py b/fence/agents/alom/fence_alom.py
index ef2db3c..7a7e38e 100644
--- a/fence/agents/alom/fence_alom.py
+++ b/fence/agents/alom/fence_alom.py
@@ -29,7 +29,7 @@ def set_power_status(conn, options):
 	conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 	# Get the machine some time between poweron and poweroff
 	time.sleep(int(options["--power-timeout"]))
-		
+
 def main():
 	device_opt = [ "ipaddr", "login", "passwd", "cmd_prompt", "secure" ]
 
@@ -40,14 +40,14 @@ def main():
 
 	options = check_input(device_opt, process_input(device_opt))
 	options["telnet_over_ssh"] = 1
-	
+
 	docs = { }
 	docs["shortdesc"] = "Fence agent for Sun ALOM"
 	docs["longdesc"] = "fence_alom is an I/O Fencing \
 agent which can be used with ALOM connected machines."
 	docs["vendorurl"] = "http://www.sun.com"
 	show_docs(options, docs)
-		
+
 	# Operate the fencing device
 	conn = fence_login(options)
 	result = fence_action(conn, options, set_power_status, get_power_status, None)
@@ -57,7 +57,7 @@ agent which can be used with ALOM connected machines."
 		conn.send_eol("logout")
 		conn.close()
 	except:
-		pass	                                         
+		pass
 
 	sys.exit(result)
 
diff --git a/fence/agents/amt/fence_amt.py b/fence/agents/amt/fence_amt.py
index 81b8aec..71288e0 100644
--- a/fence/agents/amt/fence_amt.py
+++ b/fence/agents/amt/fence_amt.py
@@ -12,140 +12,136 @@ BUILD_DATE=""
 #END_VERSION_GENERATION
 
 def get_power_status(_, options):
+	cmd = create_command(options, "status")
 
-    cmd = create_command(options, "status")
+	if options["log"] >= LOG_MODE_VERBOSE:
+		options["debug_fh"].write("executing: " + cmd + "\n")
 
-    if options["log"] >= LOG_MODE_VERBOSE:
-        options["debug_fh"].write("executing: " + cmd + "\n")
+	try:
+		process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+	except OSError:
+		fail_usage("Amttool not found or not accessible")
 
-    try:
-        process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
-    except OSError:
-        fail_usage("Amttool not found or not accessible")
+	process.wait()
 
-    process.wait()
+	output = process.communicate()
+	process.stdout.close()
+	options["debug_fh"].write(output)
 
-    output = process.communicate()
-    process.stdout.close()
-    options["debug_fh"].write(output)
+	match = re.search('Powerstate:[\\s]*(..)', str(output))
+	status = match.group(1) if match else None
 
-    match = re.search('Powerstate:[\\s]*(..)', str(output))
-    status = match.group(1) if match else None
-
-    if (status == None):
-        return "fail"
-    elif (status == "S0"): # SO = on; S3 = sleep; S5 = off
-        return "on"
-    else:
-        return "off"
+	if (status == None):
+		return "fail"
+	elif (status == "S0"): # SO = on; S3 = sleep; S5 = off
+		return "on"
+	else:
+		return "off"
 
 def set_power_status(_, options):
+	cmd = create_command(options, options["--action"])
 
-    cmd = create_command(options, options["--action"])
-
-    if options["log"] >= LOG_MODE_VERBOSE:
-        options["debug_fh"].write("executing: " + cmd + "\n")
+	if options["log"] >= LOG_MODE_VERBOSE:
+		options["debug_fh"].write("executing: " + cmd + "\n")
 
-    try:
-        process = subprocess.Popen(cmd, stdout=options["debug_fh"], stderr=options["debug_fh"], shell=True)
-    except OSError:
-        fail_usage("Amttool not found or not accessible")
+	try:
+		process = subprocess.Popen(cmd, stdout=options["debug_fh"], stderr=options["debug_fh"], shell=True)
+	except OSError:
+		fail_usage("Amttool not found or not accessible")
 
-    process.wait()
+	process.wait()
 
-    return
+	return
 
 def reboot_cycle(_, options):
-    cmd = create_command(options, "cycle")
-
-    if options["log"] >= LOG_MODE_VERBOSE:
-        options["debug_fh"].write("executing: " + cmd + "\n")
-
-    try:
-        process = subprocess.Popen(cmd, stdout=options["debug_fh"], stderr=options["debug_fh"], shell=True)
-    except OSError:
-        fail_usage("Amttool not found or not accessible")
-
-    status = process.wait()
-    
-    return not bool(status)
+	cmd = create_command(options, "cycle")
 
-def create_command(options, action):
-
-    # --password / -p
-    cmd = "AMT_PASSWORD=" + quote(options["--password"])
-
-    cmd += " " + options["--amttool-path"]
+	if options["log"] >= LOG_MODE_VERBOSE:
+		options["debug_fh"].write("executing: " + cmd + "\n")
 
-    # --ip / -a
-    cmd += " " + options["--ip"]
+	try:
+		process = subprocess.Popen(cmd, stdout=options["debug_fh"], stderr=options["debug_fh"], shell=True)
+	except OSError:
+		fail_usage("Amttool not found or not accessible")
 
-    # --action / -o
-    if action == "status":
-        cmd += " info"
-    elif action == "on":
-        cmd = "echo \"y\"|" + cmd
-        cmd += " powerup"
-    elif action == "off":
-        cmd = "echo \"y\"|" + cmd
-        cmd += " powerdown"
-    elif action == "cycle":
-        cmd = "echo \"y\"|" + cmd
-        cmd += " powercycle"
-    if action in ["on", "off", "cycle"] and options.has_key("--boot-option"):
-        cmd += options["--boot-option"]
+	status = process.wait()
 
-    # --use-sudo / -d
-    if options.has_key("--use-sudo"):
-        cmd = SUDO_PATH + " " + cmd
+	return not bool(status)
 
-    return cmd
+def create_command(options, action):
+	# --password / -p
+	cmd = "AMT_PASSWORD=" + quote(options["--password"])
+
+	cmd += " " + options["--amttool-path"]
+
+	# --ip / -a
+	cmd += " " + options["--ip"]
+
+	# --action / -o
+	if action == "status":
+		cmd += " info"
+	elif action == "on":
+		cmd = "echo \"y\"|" + cmd
+		cmd += " powerup"
+	elif action == "off":
+		cmd = "echo \"y\"|" + cmd
+		cmd += " powerdown"
+	elif action == "cycle":
+		cmd = "echo \"y\"|" + cmd
+		cmd += " powercycle"
+	if action in ["on", "off", "cycle"] and options.has_key("--boot-option"):
+		cmd += options["--boot-option"]
+
+	# --use-sudo / -d
+	if options.has_key("--use-sudo"):
+		cmd = SUDO_PATH + " " + cmd
+
+	return cmd
 
 def define_new_opts():
-    all_opt["boot_option"] = {
-        "getopt" : "b:",
-        "longopt" : "boot-option",
-        "help" : "-b, --boot-option=[option]     Change the default boot behavior of the machine. (pxe|hd|hdsafe|cd|diag)",
-        "required" : "0",
-        "shortdesc" : "Change the default boot behavior of the machine.",
-        "choices" : ["pxe", "hd", "hdsafe", "cd", "diag"],
-        "order" : 1
-        }
-    all_opt["amttool_path"] = {
-        "getopt" : "i:",
-        "longopt" : "amttool-path",
-        "help" : "--amttool-path=[path]          Path to amttool binary",
-        "required" : "0",
-        "shortdesc" : "Path to amttool binary",
-        "default" : "@AMTTOOL_PATH@",
-        "order": 200
-        }
+	all_opt["boot_option"] = {
+		"getopt" : "b:",
+		"longopt" : "boot-option",
+		"help" : "-b, --boot-option=[option]     Change the default boot behavior of the machine. (pxe|hd|hdsafe|cd|diag)",
+		"required" : "0",
+		"shortdesc" : "Change the default boot behavior of the machine.",
+		"choices" : ["pxe", "hd", "hdsafe", "cd", "diag"],
+		"order" : 1
+	}
+	all_opt["amttool_path"] = {
+		"getopt" : "i:",
+		"longopt" : "amttool-path",
+		"help" : "--amttool-path=[path]          Path to amttool binary",
+		"required" : "0",
+		"shortdesc" : "Path to amttool binary",
+		"default" : "@AMTTOOL_PATH@",
+		"order": 200
+	}
 
 def main():
+	atexit.register(atexit_handler)
 
-    atexit.register(atexit_handler)
-
-    device_opt = [ "ipaddr", "no_login", "passwd", "boot_option", "no_port",
-         "sudo", "amttool_path", "method" ]
+	device_opt = [ "ipaddr", "no_login", "passwd", "boot_option", "no_port",
+		"sudo", "amttool_path", "method" ]
 
-    define_new_opts()
+	define_new_opts()
 
-    options = check_input(device_opt, process_input(device_opt))
+	options = check_input(device_opt, process_input(device_opt))
 
-    docs = { }
-    docs["shortdesc"] = "Fence agent for AMT"
-    docs["longdesc"] = "fence_amt is an I/O Fencing agent \
+	docs = { }
+	docs["shortdesc"] = "Fence agent for AMT"
+	docs["longdesc"] = "fence_amt is an I/O Fencing agent \
 which can be used with Intel AMT. This agent calls support software amttool\
 (http://www.kraxel.org/cgit/amtterm/)."
-    docs["vendorurl"] = "http://www.intel.com/"
-    show_docs(options, docs)
+	docs["vendorurl"] = "http://www.intel.com/"
+	show_docs(options, docs)
 
-    if not is_executable(options["--amttool-path"]):
-        fail_usage("Amttool not found or not accessible")
+	if not is_executable(options["--amttool-path"]):
+		fail_usage("Amttool not found or not accessible")
 
-    result = fence_action(None, options, set_power_status, get_power_status, None, reboot_cycle)
+	result = fence_action(None, options, set_power_status, get_power_status, None, reboot_cycle)
 
-    sys.exit(result)
+	sys.exit(result)
 
 if __name__ == "__main__":
-    main()
+	main()
diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index 24ab5ee..da1b6b8 100644
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -10,7 +10,7 @@
 ##  AP7941      AOS v3.5.7, PDU APP v3.5.6
 ##  AP9606	AOS v2.5.4, PDU APP v2.7.3
 ##
-## @note: ssh is very slow on AP79XX devices protocol (1) and 
+## @note: ssh is very slow on AP79XX devices protocol (1) and
 ##        cipher (des/blowfish) have to be defined
 #####
 
@@ -66,7 +66,7 @@ def get_power_status(conn, options):
 			conn.send_eol("1")
 	else:
 		conn.send_eol(options["--switch"])
-			
+
 	while True:
 		exp_result = conn.log_expect(options, ["Press <ENTER>" ] + options["--command-prompt"], int(options["--shell-timeout"]))
 		lines = conn.before.split("\n")
@@ -78,7 +78,7 @@ def get_power_status(conn, options):
 		conn.send_eol("")
 		if exp_result != 0:
 			break
-	conn.send(chr(03))		
+	conn.send(chr(03))
 	conn.log_expect(options, "- Logout", int(options["--shell-timeout"]))
 	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 
@@ -162,7 +162,7 @@ def set_power_status(conn, options):
 	else:
 		conn.send_eol("1")
 		conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
-		
+
 	conn.send_eol(action)
 	conn.log_expect(options, "Enter 'YES' to continue or <ENTER> to cancel :", int(options["--shell-timeout"]))
 	conn.send_eol("YES")
@@ -181,9 +181,9 @@ def get_power_status5(conn, options):
 
 	exp_result = conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 	lines = conn.before.split("\n")
-		
+
 	show_re = re.compile('^\s*(\d+): (.*): (On|Off)\s*$', re.IGNORECASE)
-	
+
 	for x in lines:
 		res = show_re.search(x)
 		if (res != None):
@@ -252,8 +252,8 @@ will block any necessary fencing actions."
 	##
 	## Logout from system
 	##
-	## In some special unspecified cases it is possible that 
-	## connection will be closed before we run close(). This is not 
+	## In some special unspecified cases it is possible that
+	## connection will be closed before we run close(). This is not
 	## a problem because everything is checked before.
 	######
 	try:
@@ -261,7 +261,7 @@ will block any necessary fencing actions."
 		conn.close()
 	except:
 		pass
-	
+
 	sys.exit(result)
 
 if __name__ == "__main__":
diff --git a/fence/agents/apc_snmp/fence_apc_snmp.py b/fence/agents/apc_snmp/fence_apc_snmp.py
index da02066..1e44ae6 100644
--- a/fence/agents/apc_snmp/fence_apc_snmp.py
+++ b/fence/agents/apc_snmp/fence_apc_snmp.py
@@ -36,15 +36,15 @@ switch_id = None
 # Classes describing Device params
 class TripplitePDU:
         # Rack PDU
-        status_oid=      '.1.3.6.1.4.1.850.10.2.3.5.1.2.1.%d'
-        control_oid=     '.1.3.6.1.4.1.850.10.2.3.5.1.4.1.%d'
-        outlet_table_oid='.1.3.6.1.4.1.850.10.2.3.5.1.5'
-        ident_str="Tripplite"
-        state_on=2
-        state_off=1
-        turn_on=2
-        turn_off=1
-        has_switches=False
+	status_oid =       '.1.3.6.1.4.1.850.10.2.3.5.1.2.1.%d'
+	control_oid =      '.1.3.6.1.4.1.850.10.2.3.5.1.4.1.%d'
+	outlet_table_oid = '.1.3.6.1.4.1.850.10.2.3.5.1.5'
+	ident_str = "Tripplite"
+	state_on = 2
+	state_off = 1
+	turn_on = 2
+	turn_off = 1
+	has_switches = False
 
 class ApcRPDU:
 	# Rack PDU
diff --git a/fence/agents/bladecenter/fence_bladecenter.py b/fence/agents/bladecenter/fence_bladecenter.py
index 14a152b..6eeaeb4 100644
--- a/fence/agents/bladecenter/fence_bladecenter.py
+++ b/fence/agents/bladecenter/fence_bladecenter.py
@@ -6,7 +6,7 @@
 ##
 ##  Model                 Firmware
 ## +--------------------+---------------------------+
-## (1) Main application	  BRET85K, rev 16  
+## (1) Main application	  BRET85K, rev 16
 ##     Boot ROM           BRBR67D, rev 16
 ##     Remote Control     BRRG67D, rev 16
 ##
@@ -88,7 +88,7 @@ def main():
 
 	options = check_input(device_opt, process_input(device_opt))
 
-	docs = { }        
+	docs = { }
 	docs["shortdesc"] = "Fence agent for IBM BladeCenter"
 	docs["longdesc"] = "fence_bladecenter is an I/O Fencing agent \
 which can be used with IBM Bladecenters with recent enough firmware that \
@@ -96,7 +96,7 @@ includes telnet support. It logs into a Brocade chasis via telnet or ssh \
 and uses the command line interface to power on and off blades."
 	docs["vendorurl"] = "http://www.ibm.com"
 	show_docs(options, docs)
-	
+
 	##
 	## Operate the fencing device
 	######
@@ -111,7 +111,7 @@ and uses the command line interface to power on and off blades."
 		conn.close()
 	except:
 		pass
-	
+
 	sys.exit(result)
 
 if __name__ == "__main__":
diff --git a/fence/agents/brocade/fence_brocade.py b/fence/agents/brocade/fence_brocade.py
index 25581fd..53b4573 100644
--- a/fence/agents/brocade/fence_brocade.py
+++ b/fence/agents/brocade/fence_brocade.py
@@ -70,8 +70,8 @@ FC switch needs to be enabled. This can be done by running fence_brocade and spe
 	##
 	## Logout from system
 	##
-	## In some special unspecified cases it is possible that 
-	## connection will be closed before we run close(). This is not 
+	## In some special unspecified cases it is possible that
+	## connection will be closed before we run close(). This is not
 	## a problem because everything is checked before.
 	######
 	try:
@@ -79,7 +79,7 @@ FC switch needs to be enabled. This can be done by running fence_brocade and spe
 		conn.close()
 	except:
 		pass
-	
+
 	sys.exit(result)
 
 if __name__ == "__main__":
diff --git a/fence/agents/cisco_mds/fence_cisco_mds.py b/fence/agents/cisco_mds/fence_cisco_mds.py
index 4acce4f..2428dcf 100644
--- a/fence/agents/cisco_mds/fence_cisco_mds.py
+++ b/fence/agents/cisco_mds/fence_cisco_mds.py
@@ -86,7 +86,7 @@ def main():
 
 	options = check_input(device_opt, process_input(device_opt))
 
-	docs = { }           
+	docs = { }
 	docs["shortdesc"] = "Fence agent for Cisco MDS"
 	docs["longdesc"] = "fence_cisco_mds is an I/O Fencing agent \
 which can be used with any Cisco MDS 9000 series with SNMP enabled device."
@@ -98,7 +98,7 @@ which can be used with any Cisco MDS 9000 series with SNMP enabled device."
 
 	# Operate the fencing device
 	result = fence_action(FencingSnmp(options), options, set_power_status, get_power_status, get_outlets_status)
-	
+
 	sys.exit(result)
 
 if __name__ == "__main__":
diff --git a/fence/agents/cisco_ucs/fence_cisco_ucs.py b/fence/agents/cisco_ucs/fence_cisco_ucs.py
index 71782cb..50c1cb8 100644
--- a/fence/agents/cisco_ucs/fence_cisco_ucs.py
+++ b/fence/agents/cisco_ucs/fence_cisco_ucs.py
@@ -38,14 +38,14 @@ def set_power_status(conn, options):
 		'on' : "up",
 		'off' : "down"
 	}[options["--action"]]
-	
+
 	res = send_command(options, \
 		"<configConfMos cookie=\"" + options["cookie"] + "\" inHierarchical=\"no\">" + \
 		"<inConfigs><pair key=\"org-root" + options["--suborg"] + "/ls-" + options["--plug"] + "/power\">" + \
 		"<lsPower dn=\"org-root/ls-" + options["--plug"] + "/power\" state=\"" + action + "\" status=\"modified\" />" + \
 		"</pair></inConfigs></configConfMos>", \
 		int(options["--shell-timeout"]))
-	
+
 	return
 
 def get_list(conn, options):
@@ -112,7 +112,7 @@ def main():
 	atexit.register(atexit_handler)
 
 	define_new_opts()
-	
+
 	options = check_input(device_opt, process_input(device_opt))
 
 	docs = { }
@@ -131,7 +131,7 @@ used with Cisco UCS to fence machines."
 	try:
 		res = send_command(options, "<aaaLogin inName=\"" + options["--username"] + "\" inPassword=\"" + options["--password"] + "\" />", int(options["--login-timeout"]))
 		result = RE_COOKIE.search(res)
-		if (result == None):	
+		if (result == None):
 			## Cookie is absenting in response
 			fail(EC_LOGIN_DENIED)
 	except:
@@ -151,7 +151,7 @@ used with Cisco UCS to fence machines."
 
 	### Logout; we do not care about result as we will end in any case
 	send_command(options, "<aaaLogout inCookie=\"" + options["cookie"] + "\" />", int(options["--shell-timeout"]))
-	
+
 	sys.exit(result)
 
 if __name__ == "__main__":
diff --git a/fence/agents/drac/fence_drac.py b/fence/agents/drac/fence_drac.py
index c690b21..c2b2acc 100644
--- a/fence/agents/drac/fence_drac.py
+++ b/fence/agents/drac/fence_drac.py
@@ -35,7 +35,7 @@ def main():
 		all_opt["cmd_prompt"]["default"] = [ "\\[" + opt["--username"] + "\\]# " ]
 	else:
 		all_opt["cmd_prompt"]["default"] = [ "\\[" "username" + "\\]# " ]
-	
+
 	options = check_input(device_opt, opt)
 
 	docs = { }
@@ -64,8 +64,8 @@ To enable telnet on the DRAC: \
 	##
 	## Logout from system
 	##
-	## In some special unspecified cases it is possible that 
-	## connection will be closed before we run close(). This is not 
+	## In some special unspecified cases it is possible that
+	## connection will be closed before we run close(). This is not
 	## a problem because everything is checked before.
 	######
 	try:
@@ -73,7 +73,7 @@ To enable telnet on the DRAC: \
 		conn.close()
 	except:
 		pass
-	
+
 	sys.exit(result)
 
 if __name__ == "__main__":
diff --git a/fence/agents/drac5/fence_drac5.py b/fence/agents/drac5/fence_drac5.py
index 2c067a7..6ce0586 100644
--- a/fence/agents/drac5/fence_drac5.py
+++ b/fence/agents/drac5/fence_drac5.py
@@ -24,15 +24,15 @@ BUILD_DATE="March, 2008"
 
 def get_power_status(conn, options):
 	if options["--drac-version"] == "DRAC MC":
-		(_, status) = get_list_devices(conn,options)[options["--plug"]]
+		(_, status) = get_list_devices(conn, options)[options["--plug"]]
 	else:
 		if options["--drac-version"] == "DRAC CMC":
 			conn.send_eol("racadm serveraction powerstatus -m " + options["--plug"])
 		elif options["--drac-version"] == "DRAC 5":
 			conn.send_eol("racadm serveraction powerstatus")
-		
+
 		conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
-				
+
 		status = re.compile("(^|: )(ON|OFF|Powering ON|Powering OFF)\s*$", re.IGNORECASE | re.MULTILINE).search(conn.before).group(2)
 
 	if status.lower().strip() in ["on", "powering on", "powering off"]:
@@ -111,8 +111,8 @@ def main():
 
 	options = check_input(device_opt, process_input(device_opt))
 
-	docs = { }           
-	docs["shortdesc"] = "Fence agent for Dell DRAC CMC/5" 
+	docs = { }
+	docs["shortdesc"] = "Fence agent for Dell DRAC CMC/5"
 	docs["longdesc"] = "fence_drac5 is an I/O Fencing agent \
 which can be used with the Dell Remote Access Card v5 or CMC (DRAC). \
 This device provides remote access to controlling  power to a server. \
@@ -129,7 +129,7 @@ By default, the telnet interface is not  enabled."
 	if options.has_key("--drac-version") == False:
 		## autodetect from text issued by fence device
 		if conn.before.find("CMC") >= 0:
-	  		options["--drac-version"] = "DRAC CMC"
+			options["--drac-version"] = "DRAC CMC"
 		elif conn.before.find("DRAC 5") >= 0:
 			options["--drac-version"] = "DRAC 5"
 		elif conn.after.find("DRAC/MC") >= 0:
@@ -153,7 +153,7 @@ By default, the telnet interface is not  enabled."
 		conn.close()
 	except:
 		pass
-	
+
 	sys.exit(result)
 
 if __name__ == "__main__":
diff --git a/fence/agents/dummy/fence_dummy.py b/fence/agents/dummy/fence_dummy.py
index d5bb748..1f9ddf1 100644
--- a/fence/agents/dummy/fence_dummy.py
+++ b/fence/agents/dummy/fence_dummy.py
@@ -10,7 +10,7 @@ REDHAT_COPYRIGHT=""
 BUILD_DATE=""
 #END_VERSION_GENERATION
 
-plug_status="on"
+plug_status = "on"
 
 def get_power_status_file(conn, options):
 	try:
@@ -32,7 +32,7 @@ def set_power_status_file(conn, options):
 	status_file.close()
 
 def get_power_status_fail(conn, options):
-	outlets = get_outlets_fail(conn,options)
+	outlets = get_outlets_fail(conn, options)
 
 	if len(outlets) == 0 or options.has_key("--plug") == 0:
 		fail_usage("Failed: You have to enter existing machine!")
@@ -124,7 +124,7 @@ def main():
 		result = fence_action(None, options, set_power_status_fail, get_power_status_fail, get_outlets_fail)
 	else:
 		result = fence_action(None, options, set_power_status_file, get_power_status_file, None)
-		
+
 	sys.exit(result)
 
 if __name__ == "__main__":
diff --git a/fence/agents/eps/fence_eps.py b/fence/agents/eps/fence_eps.py
index 0e7709d..6f2c6da 100644
--- a/fence/agents/eps/fence_eps.py
+++ b/fence/agents/eps/fence_eps.py
@@ -38,7 +38,7 @@ def eps_run_command(options, params):
 		if (options.has_key("--username")):
 			if (not options.has_key("--password")):
 				options["--password"] = "" # Default is empty password
-				
+
 			# String for Authorization header
 			auth_str = 'Basic ' + string.strip(base64.encodestring(options["--username"]+':'+options["--password"]))
 			eps_log(options, "Authorization:"+auth_str+"\n")
@@ -107,8 +107,8 @@ def main():
 
 	options = check_input(device_opt, process_input(device_opt))
 
-	docs = { }           
-	docs["shortdesc"] = "Fence agent for ePowerSwitch" 
+	docs = { }
+	docs["shortdesc"] = "Fence agent for ePowerSwitch"
 	docs["longdesc"] = "fence_eps  is an I/O Fencing agent \
 which can be used with the ePowerSwitch 8M+ power switch to fence \
 connected machines. Fence agent works ONLY on 8M+ device, because \
diff --git a/fence/agents/hds_cb/fence_hds_cb.py b/fence/agents/hds_cb/fence_hds_cb.py
index 0e15af3..9bdf083 100755
--- a/fence/agents/hds_cb/fence_hds_cb.py
+++ b/fence/agents/hds_cb/fence_hds_cb.py
@@ -60,7 +60,6 @@ def set_power_status(conn, options):
 		'off': "F",
 		'reboot' : "H",
 	}[options["--action"]]
-	
 
 	conn.sendline("S")	# Enter System Command Mode
 	conn.log_expect(options, "SVP>", int(options["--shell-timeout"]))
@@ -98,7 +97,7 @@ def get_blades_list(conn, options):
 	for line in conn.before.splitlines():
 		partition = re.search(RE_STATUS_LINE, line)
 		if( partition != None):
-			outlets[partition.group(1)] = (partition.group(2), "")	
+			outlets[partition.group(1)] = (partition.group(2), "")
 	conn.sendline("Q")	# Quit back to system command mode
 	conn.log_expect(options, "SVP>", int(options["--shell-timeout"]))
 	conn.sendline("EX")	# Quit back to system console menu
@@ -124,7 +123,7 @@ which can be used with Hitachi Compute Blades with recent enough firmware that \
 includes telnet support."
 	docs["vendorurl"] = "http://www.hds.com"
 	show_docs(options, docs)
-	
+
 	##
 	## Operate the fencing device
 	######
@@ -139,7 +138,7 @@ includes telnet support."
 		conn.close()
 	except:
 		pass
-	
+
 	sys.exit(result)
 
 if __name__ == "__main__":
diff --git a/fence/agents/hpblade/fence_hpblade.py b/fence/agents/hpblade/fence_hpblade.py
index 42f5309..238e549 100644
--- a/fence/agents/hpblade/fence_hpblade.py
+++ b/fence/agents/hpblade/fence_hpblade.py
@@ -19,7 +19,7 @@ BUILD_DATE="March, 2008"
 def get_power_status(conn, options):
 	conn.send_eol("show server status " + options["--plug"])
 	conn.log_expect(options, options["--command-prompt"] , int(options["--shell-timeout"]))
-		
+
 	power_re = re.compile("^\s*Power: (.*?)\s*$")
 	status = "unknown"
 	for line in conn.before.splitlines():
@@ -65,14 +65,14 @@ def main():
 
 	options = check_input(device_opt, process_input(device_opt))
 
-	docs = { }        
+	docs = { }
 	docs["shortdesc"] = "Fence agent for HP BladeSystem"
 	docs["longdesc"] = "fence_hpblade is an I/O Fencing agent \
 which can be used with HP BladeSystem. It logs into an enclosure via telnet or ssh \
 and uses the command line interface to power on and off blades."
 	docs["vendorurl"] = "http://www.hp.com"
 	show_docs(options, docs)
-	
+
 	##
 	## Operate the fencing device
 	######
@@ -88,7 +88,7 @@ and uses the command line interface to power on and off blades."
 		conn.close()
 	except:
 		pass
-	
+
 	sys.exit(result)
 
 if __name__ == "__main__":
diff --git a/fence/agents/ifmib/fence_ifmib.py b/fence/agents/ifmib/fence_ifmib.py
index 2184a85..eabcbe9 100644
--- a/fence/agents/ifmib/fence_ifmib.py
+++ b/fence/agents/ifmib/fence_ifmib.py
@@ -119,7 +119,7 @@ to control the state of an interface."
 
 	# Operate the fencing device
 	result = fence_action(FencingSnmp(options), options, set_power_status, get_power_status, get_outlets_status)
-	
+
 	sys.exit(result)
 
 if __name__ == "__main__":
diff --git a/fence/agents/ilo/fence_ilo.py b/fence/agents/ilo/fence_ilo.py
index 444f94b..779b9a5 100644
--- a/fence/agents/ilo/fence_ilo.py
+++ b/fence/agents/ilo/fence_ilo.py
@@ -7,7 +7,7 @@
 ##  iLO Version
 ## +---------------------------------------------+
 ##  iLO  / firmware 1.91 / RIBCL 2.22
-##  iLO2 / firmware 1.22 / RIBCL 2.22 
+##  iLO2 / firmware 1.22 / RIBCL 2.22
 ##  iLO2 / firmware 1.50 / RIBCL 2.22
 #####
 
@@ -121,7 +121,7 @@ the iLO card through an XML stream."
 	## Fence operations
 	####
 	result = fence_action(conn, options, set_power_status, get_power_status, None)
-	
+
 	sys.exit(result)
 
 if __name__ == "__main__":
diff --git a/fence/agents/ilo_mp/fence_ilo_mp.py b/fence/agents/ilo_mp/fence_ilo_mp.py
index b1202bb..23aa8cc 100644
--- a/fence/agents/ilo_mp/fence_ilo_mp.py
+++ b/fence/agents/ilo_mp/fence_ilo_mp.py
@@ -12,7 +12,7 @@ BUILD_DATE=""
 
 def get_power_status(conn, options):
 	conn.send_eol("show /system1")
-		
+
 	re_state = re.compile('EnabledState=(.*)', re.IGNORECASE)
 	conn.log_expect(options, re_state, int(options["--shell-timeout"]))
 
@@ -37,18 +37,18 @@ def main():
 	device_opt = [  "ipaddr", "login", "passwd", "secure", "cmd_prompt" ]
 
 	atexit.register(atexit_handler)
-	
+
 	all_opt["cmd_prompt"]["default"] = [ "MP>", "hpiLO->" ]
 	all_opt["power_wait"]["default"] = 5
-	
+
 	options = check_input(device_opt, process_input(device_opt))
-		
+
 	docs = { }
 	docs["shortdesc"] = "Fence agent for HP iLO MP"
 	docs["longdesc"] = ""
 	docs["vendorurl"] = "http://www.hp.com"
 	show_docs(options, docs)
-	
+
 	conn = fence_login(options)
 	conn.send_eol("SMCLP")
 
@@ -61,7 +61,7 @@ def main():
 		conn.send_eol("exit")
 	except:
 		pass
-	
+
 	sys.exit(result)
 
 if __name__ == "__main__":
diff --git a/fence/agents/intelmodular/fence_intelmodular.py b/fence/agents/intelmodular/fence_intelmodular.py
index 192d2e3..35091a0 100644
--- a/fence/agents/intelmodular/fence_intelmodular.py
+++ b/fence/agents/intelmodular/fence_intelmodular.py
@@ -85,7 +85,7 @@ for command line and snmp_version option for your cluster.conf."
 
 	# Operate the fencing device
 	result = fence_action(FencingSnmp(options), options, set_power_status, get_power_status, get_outlets_status)
-	
+
 	sys.exit(result)
 
 if __name__ == "__main__":
diff --git a/fence/agents/ipmilan/fence_ipmilan.py b/fence/agents/ipmilan/fence_ipmilan.py
index de42524..0cea62b 100644
--- a/fence/agents/ipmilan/fence_ipmilan.py
+++ b/fence/agents/ipmilan/fence_ipmilan.py
@@ -13,188 +13,188 @@ BUILD_DATE=""
 
 def get_power_status(_, options):
 
-    cmd = create_command(options, "status")
+	cmd = create_command(options, "status")
 
-    if options["log"] >= LOG_MODE_VERBOSE:
-        options["debug_fh"].write("executing: " + cmd + "\n")
+	if options["log"] >= LOG_MODE_VERBOSE:
+		options["debug_fh"].write("executing: " + cmd + "\n")
 
-    try:
-        process = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-    except OSError:
-        fail_usage("Ipmitool not found or not accessible")
+	try:
+		process = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+	except OSError:
+		fail_usage("Ipmitool not found or not accessible")
 
-    process.wait()
+	process.wait()
 
-    out = process.communicate()
-    process.stdout.close()
-    options["debug_fh"].write(str(out) + "\n")
+	out = process.communicate()
+	process.stdout.close()
+	options["debug_fh"].write(str(out) + "\n")
 
-    match = re.search('[Cc]hassis [Pp]ower is [\\s]*([a-zA-Z]{2,3})', str(out))
-    status = match.group(1) if match else None
+	match = re.search('[Cc]hassis [Pp]ower is [\\s]*([a-zA-Z]{2,3})', str(out))
+	status = match.group(1) if match else None
 
-    return status
+	return status
 
 def set_power_status(_, options):
 
-    cmd = create_command(options, options["--action"])
+	cmd = create_command(options, options["--action"])
 
-    if options["log"] >= LOG_MODE_VERBOSE:
-        options["debug_fh"].write("executing: " + cmd + "\n")
+	if options["log"] >= LOG_MODE_VERBOSE:
+		options["debug_fh"].write("executing: " + cmd + "\n")
 
-    try:
-        process = subprocess.Popen(shlex.split(cmd), stdout=options["debug_fh"], stderr=options["debug_fh"])
-    except OSError:
-        fail_usage("Ipmitool not found or not accessible")
+	try:
+		process = subprocess.Popen(shlex.split(cmd), stdout=options["debug_fh"], stderr=options["debug_fh"])
+	except OSError:
+		fail_usage("Ipmitool not found or not accessible")
 
-    process.wait()
+	process.wait()
 
-    return
+	return
 
 def reboot_cycle(_, options):
-    cmd = create_command(options, "cycle")
+	cmd = create_command(options, "cycle")
 
-    if options["log"] >= LOG_MODE_VERBOSE:
-        options["debug_fh"].write("executing: " + cmd + "\n")
+	if options["log"] >= LOG_MODE_VERBOSE:
+		options["debug_fh"].write("executing: " + cmd + "\n")
 
-    try:
-        process = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-    except OSError:
-        fail_usage("Ipmitool not found or not accessible")
+	try:
+		process = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+	except OSError:
+		fail_usage("Ipmitool not found or not accessible")
 
-    process.wait()
+	process.wait()
 
-    out = process.communicate()
-    process.stdout.close()
-    options["debug_fh"].write(str(out) + "\n")
+	out = process.communicate()
+	process.stdout.close()
+	options["debug_fh"].write(str(out) + "\n")
 
-    return bool(re.search('chassis power control: cycle', str(out).lower()))
+	return bool(re.search('chassis power control: cycle', str(out).lower()))
 
 def create_command(options, action):
-    cmd = options["--ipmitool-path"]
+	cmd = options["--ipmitool-path"]
 
-    # --lanplus / -L
-    if options.has_key("--lanplus") and options["--lanplus"] in ["", "1"]:
-        cmd += " -I lanplus"
-    else:
-        cmd += " -I lan"
-    # --ip / -a
-    cmd += " -H " + options["--ip"]
+	# --lanplus / -L
+	if options.has_key("--lanplus") and options["--lanplus"] in ["", "1"]:
+		cmd += " -I lanplus"
+	else:
+		cmd += " -I lan"
+	# --ip / -a
+	cmd += " -H " + options["--ip"]
 
-    # --username / -l
-    if options.has_key("--username") and len(options["--username"]) != 0:
-        cmd += " -U " + quote(options["--username"])
+	# --username / -l
+	if options.has_key("--username") and len(options["--username"]) != 0:
+		cmd += " -U " + quote(options["--username"])
 
-    # --auth / -A
-    if options.has_key("--auth"):
-        cmd += " -A " + options["--auth"]
+	# --auth / -A
+	if options.has_key("--auth"):
+		cmd += " -A " + options["--auth"]
 
-    # --password / -p
-    if options.has_key("--password"):
-        cmd += " -P " + quote(options["--password"])
+	# --password / -p
+	if options.has_key("--password"):
+		cmd += " -P " + quote(options["--password"])
 
-    # --cipher / -C
-    cmd += " -C " + options["--cipher"]
+	# --cipher / -C
+		cmd += " -C " + options["--cipher"]
 
-    # --port / -n
-    if options.has_key("--ipport"):
-        cmd += " -p " + options["--ipport"]
+	# --port / -n
+	if options.has_key("--ipport"):
+		cmd += " -p " + options["--ipport"]
 
-    if options.has_key("--privlvl"):
-        cmd += " -L " + options["--privlvl"]
+	if options.has_key("--privlvl"):
+		cmd += " -L " + options["--privlvl"]
 
-    # --action / -o
-    cmd += " chassis power " + action
+	# --action / -o
+		cmd += " chassis power " + action
 
-     # --use-sudo / -d
-    if options.has_key("--use-sudo"):
-        cmd = SUDO_PATH + " " + cmd
+	# --use-sudo / -d
+	if options.has_key("--use-sudo"):
+		cmd = SUDO_PATH + " " + cmd
 
-    return cmd
+	return cmd
 
 def define_new_opts():
-    all_opt["lanplus"] = {
-        "getopt" : "P",
-        "longopt" : "lanplus",
-        "help" : "-P, --lanplus                  Use Lanplus to improve security of connection",
-        "required" : "0",
-        "default" : "0",
-        "shortdesc" : "Use Lanplus to improve security of connection",
-        "order": 1
-        }
-    all_opt["auth"] = {
-        "getopt" : "A:",
-        "longopt" : "auth",
-        "help" : "-A, --auth=[auth]              IPMI Lan Auth type (md5|password|none)",
-        "required" : "0",
-        "shortdesc" : "IPMI Lan Auth type.",
-        "choices" : ["md5", "password", "none"],
-        "order": 1
-        }
-    all_opt["cipher"] = {
-        "getopt" : "C:",
-        "longopt" : "cipher",
-        "help" : "-C, --cipher=[cipher]          Ciphersuite to use (same as ipmitool -C parameter)",
-        "required" : "0",
-        "shortdesc" : "Ciphersuite to use (same as ipmitool -C parameter)",
-        "default" : "0",
-        "order": 1
-        }
-    all_opt["privlvl"] = {
-        "getopt" : "L:",
-        "longopt" : "privlvl",
-        "help" : "-L, --privlvl=[level]          Privilege level on IPMI device (callback|user|operator|administrator)",
-        "required" : "0",
-        "shortdesc" : "Privilege level on IPMI device",
-        "default" : "administrator",
-        "choices" : ["callback", "user", "operator", "administrator"],
-        "order": 1
-        }
-    all_opt["ipmitool_path"] = {
-        "getopt" : "i:",
-        "longopt" : "ipmitool-path",
-        "help" : "--ipmitool-path=[path]         Path to ipmitool binary",
-        "required" : "0",
-        "shortdesc" : "Path to ipmitool binary",
-        "default" : "@IPMITOOL_PATH@",
-        "order": 200
-        }
+	all_opt["lanplus"] = {
+		"getopt" : "P",
+		"longopt" : "lanplus",
+		"help" : "-P, --lanplus                  Use Lanplus to improve security of connection",
+		"required" : "0",
+		"default" : "0",
+		"shortdesc" : "Use Lanplus to improve security of connection",
+		"order": 1
+	}
+	all_opt["auth"] = {
+		"getopt" : "A:",
+		"longopt" : "auth",
+		"help" : "-A, --auth=[auth]              IPMI Lan Auth type (md5|password|none)",
+		"required" : "0",
+		"shortdesc" : "IPMI Lan Auth type.",
+		"choices" : ["md5", "password", "none"],
+		"order": 1
+	}
+	all_opt["cipher"] = {
+		"getopt" : "C:",
+		"longopt" : "cipher",
+		"help" : "-C, --cipher=[cipher]          Ciphersuite to use (same as ipmitool -C parameter)",
+		"required" : "0",
+		"shortdesc" : "Ciphersuite to use (same as ipmitool -C parameter)",
+		"default" : "0",
+		"order": 1
+	}
+	all_opt["privlvl"] = {
+		"getopt" : "L:",
+		"longopt" : "privlvl",
+		"help" : "-L, --privlvl=[level]          Privilege level on IPMI device (callback|user|operator|administrator)",
+		"required" : "0",
+		"shortdesc" : "Privilege level on IPMI device",
+		"default" : "administrator",
+		"choices" : ["callback", "user", "operator", "administrator"],
+		"order": 1
+	}
+	all_opt["ipmitool_path"] = {
+		"getopt" : "i:",
+		"longopt" : "ipmitool-path",
+		"help" : "--ipmitool-path=[path]         Path to ipmitool binary",
+		"required" : "0",
+		"shortdesc" : "Path to ipmitool binary",
+		"default" : "@IPMITOOL_PATH@",
+		"order": 200
+	}
 
 def main():
 
-    atexit.register(atexit_handler)
+	atexit.register(atexit_handler)
 
-    device_opt = ["ipaddr", "login", "no_login", "no_password", "passwd",
-                  "lanplus", "auth", "cipher", "privlvl", "sudo", "ipmitool_path", "method"]
-    define_new_opts()
+	device_opt = ["ipaddr", "login", "no_login", "no_password", "passwd",
+		"lanplus", "auth", "cipher", "privlvl", "sudo", "ipmitool_path", "method"]
+	define_new_opts()
 
-    if os.path.basename(sys.argv[0]) == "fence_ilo3":
-        all_opt["power_wait"]["default"] = "4"
-        all_opt["method"]["default"] = "cycle"
-        all_opt["lanplus"]["default"] = "1"
-    elif os.path.basename(sys.argv[0]) == "fence_ilo4":
-        all_opt["lanplus"]["default"] = "1"
+	if os.path.basename(sys.argv[0]) == "fence_ilo3":
+		all_opt["power_wait"]["default"] = "4"
+		all_opt["method"]["default"] = "cycle"
+		all_opt["lanplus"]["default"] = "1"
+	elif os.path.basename(sys.argv[0]) == "fence_ilo4":
+		all_opt["lanplus"]["default"] = "1"
 
-    all_opt["ipport"]["default"] = "623"
+	all_opt["ipport"]["default"] = "623"
 
-    options = check_input(device_opt, process_input(device_opt))
+	options = check_input(device_opt, process_input(device_opt))
 
-    docs = { }
-    docs["shortdesc"] = "Fence agent for IPMI"
-    docs["longdesc"] = "fence_ipmilan is an I/O Fencing agent\
+	docs = { }
+	docs["shortdesc"] = "Fence agent for IPMI"
+	docs["longdesc"] = "fence_ipmilan is an I/O Fencing agent\
 which can be used with machines controlled by IPMI.\
 This agent calls support software ipmitool (http://ipmitool.sf.net/)."
-    docs["vendorurl"] = ""
-    docs["symlink"] = [("fence_ilo3", "Fence agent for HP iLO3"),
-                       ("fence_ilo4", "Fence agent for HP iLO4"),
-                       ("fence_imm", "Fence agent for IBM Integrated Management Module"),
-                       ("fence_idrac", "Fence agent for Dell iDRAC")]
-    show_docs(options, docs)
+	docs["vendorurl"] = ""
+	docs["symlink"] = [("fence_ilo3", "Fence agent for HP iLO3"),
+		("fence_ilo4", "Fence agent for HP iLO4"),
+		("fence_imm", "Fence agent for IBM Integrated Management Module"),
+		("fence_idrac", "Fence agent for Dell iDRAC")]
+	show_docs(options, docs)
 
-    if not is_executable(options["--ipmitool-path"]):
-        fail_usage("Ipmitool not found or not accessible")
+	if not is_executable(options["--ipmitool-path"]):
+		fail_usage("Ipmitool not found or not accessible")
 
-    result = fence_action(None, options, set_power_status, get_power_status, None, reboot_cycle)
-    sys.exit(result)
+	result = fence_action(None, options, set_power_status, get_power_status, None, reboot_cycle)
+	sys.exit(result)
 
 if __name__ == "__main__":
-    main()
+	main()
diff --git a/fence/agents/ldom/fence_ldom.py b/fence/agents/ldom/fence_ldom.py
index 722bfda..acddffe 100644
--- a/fence/agents/ldom/fence_ldom.py
+++ b/fence/agents/ldom/fence_ldom.py
@@ -2,9 +2,9 @@
 
 ##
 ## The Following Agent Has Been Tested On - LDOM 1.0.3
-## The interface is backward compatible so it will work 
+## The interface is backward compatible so it will work
 ## with 1.0, 1.0.1 and .2 too.
-## 
+##
 #####
 
 import sys, re, pexpect, exceptions
@@ -28,20 +28,19 @@ def start_communication(conn, options):
 		#CSH stuff
 		conn.send_eol("set prompt='"+COMMAND_PROMPT_NEW+"'")
 		conn.log_expect(options, COMMAND_PROMPT_REG, int(options["--shell-timeout"]))
-	
 
 def get_power_status(conn, options):
 	start_communication(conn, options)
-		
+
 	conn.send_eol("ldm ls")
-		    
+
 	conn.log_expect(options, COMMAND_PROMPT_REG, int(options["--shell-timeout"]))
 
 	result = {}
 
 	#This is status of mini finite automata. 0 = we didn't found NAME and STATE, 1 = we did
 	fa_status = 0
-		
+
 	for line in conn.before.splitlines():
 		domain = re.search("^(\S+)\s+(\S+)\s+.*$", line)
 
@@ -61,13 +60,13 @@ def get_power_status(conn, options):
 
 def set_power_status(conn, options):
 	start_communication(conn, options)
-         	
+
 	cmd_line = "ldm "+(options["--action"]=="on" and "start" or "stop -f")+" \""+options["--plug"]+"\""
-            	
+
 	conn.send_eol(cmd_line)
-		    
+
 	conn.log_expect(options, COMMAND_PROMPT_REG, int(options["--power-timeout"]))
-		
+
 def main():
 	device_opt = [ "ipaddr", "login", "passwd", "cmd_prompt", "secure", "port" ]
 
@@ -112,7 +111,7 @@ root. Than prompt is $, so again, you must use parameter -c."
 	except pexpect.ExceptionPexpect:
 		pass
 
-	sys.exit(result)		
+	sys.exit(result)
 
 if __name__ == "__main__":
 	main()
diff --git a/fence/agents/lib/check_used_options.py b/fence/agents/lib/check_used_options.py
index 86dc35f..2d2abbc 100755
--- a/fence/agents/lib/check_used_options.py
+++ b/fence/agents/lib/check_used_options.py
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 
-## Check if fence agent uses only options["--??"] which are defined in fencing library or 
+## Check if fence agent uses only options["--??"] which are defined in fencing library or
 ## fence agent itself
 ##
 ## Usage: ./check_used_options.py fence-agent (e.g. lpar/fence_lpar.py)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 5dd188e..9ef3c8e 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -39,7 +39,7 @@ all_opt = {
 		"required" : "0",
 		"shortdesc" : "Display help and exit",
 		"order" : 54 },
-	"version" : { 
+	"version" : {
 		"getopt" : "V",
 		"longopt" : "version",
 		"help" : "-V, --version                  Output version information and exit",
@@ -55,7 +55,7 @@ all_opt = {
 		"order" : 51 },
 	"debug" : {
 		"getopt" : "D:",
-		"longopt" : "debug-file", 
+		"longopt" : "debug-file",
 		"help" : "-D, --debug-file=[debugfile]   Debugging to output file",
 		"required" : "0",
 		"shortdesc" : "Write debug information to given file",
@@ -101,7 +101,7 @@ all_opt = {
 		"help" : "-u, --ipport=[port]            TCP/UDP port to use",
 		"required" : "0",
 		"shortdesc" : "TCP/UDP port to use for connection with device",
-		"order" : 1 },		
+		"order" : 1 },
 	"login" : {
 		"getopt" : "l:",
 		"longopt" : "username",
@@ -120,7 +120,7 @@ all_opt = {
 	"no_port" : {
 		"getopt" : "",
 		"help" : "",
-		"order" : 1 },	
+		"order" : 1 },
 	"passwd" : {
 		"getopt" : "p:",
 		"longopt" : "password",
@@ -181,7 +181,7 @@ all_opt = {
 	"port" : {
 		"getopt" : "n:",
 		"longopt" : "plug",
-		"help" : "-n, --plug=[id]                Physical plug number on device, UUID or\n" + 
+		"help" : "-n, --plug=[id]                Physical plug number on device, UUID or\n" +
         "                                        identification of machine",
 		"required" : "1",
 		"shortdesc" : "Physical plug number, name of virtual machine or UUID",
@@ -286,7 +286,7 @@ all_opt = {
 		"getopt" : "C:",
 		"longopt" : "separator",
 		"help" : "-C, --separator=[char]         Separator for CSV created by 'list' operation",
-		"default" : ",", 
+		"default" : ",",
 		"required" : "0",
 		"shortdesc" : "Separator for CSV created by operation list",
 		"order" : 100 },
@@ -294,7 +294,7 @@ all_opt = {
 		"getopt" : "y:",
 		"longopt" : "login-timeout",
 		"help" : "--login-timeout=[seconds]      Wait X seconds for cmd prompt after login",
-		"default" : "5", 
+		"default" : "5",
 		"required" : "0",
 		"shortdesc" : "Wait X seconds for cmd prompt after login",
 		"order" : 200 },
@@ -302,7 +302,7 @@ all_opt = {
 		"getopt" : "Y:",
 		"longopt" : "shell-timeout",
 		"help" : "--shell-timeout=[seconds]      Wait X seconds for cmd prompt after issuing command",
-		"default" : "3", 
+		"default" : "3",
 		"required" : "0",
 		"shortdesc" : "Wait X seconds for cmd prompt after issuing command",
 		"order" : 200 },
@@ -310,7 +310,7 @@ all_opt = {
 		"getopt" : "g:",
 		"longopt" : "power-timeout",
 		"help" : "--power-timeout=[seconds]      Test X seconds for status change after ON/OFF",
-		"default" : "20", 
+		"default" : "20",
 		"required" : "0",
 		"shortdesc" : "Test X seconds for status change after ON/OFF",
 		"order" : 200 },
@@ -318,7 +318,7 @@ all_opt = {
 		"getopt" : "G:",
 		"longopt" : "power-wait",
 		"help" : "--power-wait=[seconds]         Wait X seconds after issuing ON/OFF",
-		"default" : "0", 
+		"default" : "0",
 		"required" : "0",
 		"shortdesc" : "Wait X seconds after issuing ON/OFF",
 		"order" : 200 },
@@ -378,7 +378,7 @@ class fspawn(pexpect.spawn):
 	def __init__(self, options, command):
 		pexpect.spawn.__init__(self, command)
 		self.opt = options
-		
+
 	def log_expect(self, options, pattern, timeout):
 		result = self.expect(pattern, timeout)
 		if options["log"] >= LOG_MODE_VERBOSE:
@@ -400,7 +400,7 @@ def atexit_handler():
 
 def add_dependency_options(options):
 	## Add options which are available for every fence agent
-	added_opt = [] 
+	added_opt = []
 	for x in options + ["default"]:
 		if DEPENDENCY_OPT.has_key(x):
 			added_opt.extend([y for y in DEPENDENCY_OPT[x] if options.count(y) == 0])
@@ -504,7 +504,7 @@ def metadata(avail_opt, options, docs):
 				print "\t\t<content type=\"string\" "+default+" />"
 			else:
 				print "\t\t<content type=\"boolean\" "+default+" />"
-				
+
 			print "\t\t<shortdesc lang=\"en\">" + all_opt[option]["shortdesc"] + "</shortdesc>"
 			print "\t</parameter>"
 	print "</parameters>"
@@ -522,7 +522,7 @@ def metadata(avail_opt, options, docs):
 	print "\t<action name=\"status\" />"
 	print "\t<action name=\"list\" />"
 	print "\t<action name=\"monitor\" />"
-	print "\t<action name=\"metadata\" />"	
+	print "\t<action name=\"metadata\" />"
 	print "</actions>"
 	print "</resource-agent>"
 
@@ -609,14 +609,14 @@ def process_input(avail_opt):
 	return opt
 
 ##
-## This function checks input and answers if we want to have same answers 
+## This function checks input and answers if we want to have same answers
 ## in each of the fencing agents. It looks for possible errors and run
 ## password script to set a correct password
 ######
 def check_input(device_opt, opt):
 
 	device_opt.extend(add_dependency_options(device_opt))
-	
+
 	options = dict(opt)
 	options["device_opt"] = device_opt
 
@@ -662,7 +662,7 @@ def check_input(device_opt, opt):
 			else:
 				all_opt["ipport"]["help"] = "-u, --ipport=[port]            TCP/UDP port to use\n\
                                         (default 23, 22 if --ssh option is used)"
-				
+
 
 	## In special cases (show help, metadata or version) we don't need to check anything
 	#####
@@ -687,7 +687,7 @@ def check_input(device_opt, opt):
 	if 0 == acceptable_actions.count(options["--action"]):
 		fail_usage("Failed: Unrecognised action '" + options["--action"] + "'")
 
-	## Compatibility layer 
+	## Compatibility layer
 	#####
 	if options["--action"] == "enable":
 		options["--action"] = "on"
@@ -705,7 +705,7 @@ def check_input(device_opt, opt):
 		if 0 == device_opt.count("identity_file"):
 			if 0 == (options.has_key("--password") or options.has_key("--password-script")):
 				fail_usage("Failed: You have to enter password or password script")
-		else: 
+		else:
 			if 0 == (options.has_key("--password") or options.has_key("--password-script") or options.has_key("--identity-file")):
 				fail_usage("Failed: You have to enter password, password script or identity file")
 
@@ -758,7 +758,7 @@ def check_input(device_opt, opt):
 					fail_usage("Failed: You have to enter a valid choice for %s from the valid values: %s" % ("--" + all_opt[opt]["longopt"] , str(all_opt[opt]["choices"])))
 
 	return options
-	
+
 def wait_power_status(tn, options, get_power_fn):
 	for dummy in xrange(int(options["--power-timeout"])):
 		if get_multi_power_fn(tn, options, get_power_fn) != options["--action"]:
@@ -788,7 +788,7 @@ def get_multi_power_fn(tn, options, get_power_fn):
 				status = plug_status
 	else:
 		status = get_power_fn(tn, options)
-	
+
 	return status
 
 def set_multi_power_fn(tn, options, set_power_fn):
@@ -812,10 +812,10 @@ def show_docs(options, docs = None):
 		docs = { }
 		docs["shortdesc"] = "Fence agent"
 		docs["longdesc"] = ""
-	
+
 	## Process special options (and exit)
 	#####
-	if options.has_key("--help"): 
+	if options.has_key("--help"):
 		usage(device_opt)
 		sys.exit(0)
 
@@ -843,7 +843,7 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
 		elif (options["--action"] == "list" and get_outlet_list == None):
 			## @todo: exception?
 			## This is just temporal solution, we will remove default value
-			## None as soon as all existing agent will support this operation 
+			## None as soon as all existing agent will support this operation
 			print "NOTICE: List option is not working on this device yet"
 			return
 		elif (options["--action"] == "list") or ((options["--action"] == "monitor") and 1 == options["device_opt"].count("port")):
@@ -852,12 +852,12 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
 			for o in outlets.keys():
 				(alias, status) = outlets[o]
 				if options["--action"] != "monitor":
-					print o + options["--separator"] + alias	
+					print o + options["--separator"] + alias
 			return
 
 		status = get_multi_power_fn(tn, options, get_power_fn)
 
-		if status != "on" and status != "off":  
+		if status != "on" and status != "off":
 			fail(EC_STATUS)
 
 		if options["--action"] == "on":
@@ -940,11 +940,11 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
 		sys.stderr.write(ex[1] + "\n")
 		syslog.syslog(syslog.LOG_ERR, ex[1])
 		fail(EC_TIMED_OUT)
-	
+
 	return result
 
 def fence_login(options, re_login_string = "(login\s*: )|(Login Name:  )|(username: )|(User Name :)"):
-	force_ipvx=""
+	force_ipvx = ""
 
 	if (options.has_key("--inet6-only")):
 		force_ipvx = "-6 "
@@ -968,7 +968,7 @@ def fence_login(options, re_login_string = "(login\s*: )|(Login Name:  )|(userna
 		re_pass  = re.compile("(password)|(pass phrase)", re.IGNORECASE)
 
 		if options.has_key("--ssl"):
-			gnutls_opts=""
+			gnutls_opts = ""
 			if options.has_key("--notls"):
 				gnutls_opts = "--priority \"NORMAL:-VERS-TLS1.2:-VERS-TLS1.1:-VERS-TLS1.0:+VERS-SSL3.0\""
 
@@ -985,7 +985,7 @@ def fence_login(options, re_login_string = "(login\s*: )|(Login Name:  )|(userna
 				command += ' ' + options["--ssh-options"]
 
 			conn = fspawn(options, command)
-				
+
 			if options.has_key("telnet_over_ssh"):
 				#This is for stupid ssh servers (like ALOM) which behave more like telnet (ignore name and display login prompt)
 				result = conn.log_expect(options, [ re_login, "Are you sure you want to continue connecting (yes/no)?" ], int(options["--login-timeout"]))
@@ -1010,7 +1010,7 @@ def fence_login(options, re_login_string = "(login\s*: )|(Login Name:  )|(userna
 
 			conn = fspawn(options, command)
 
-			result = conn.log_expect(options, [ "Enter passphrase for key '" + options["--identity-file"] + "':",\
+			result = conn.log_expect(options, [ "Enter passphrase for key '" + options["--identity-file"] + "':", \
 				"Are you sure you want to continue connecting (yes/no)?" ] + options["--command-prompt"], int(options["--login-timeout"]))
 			if result == 1:
 				conn.sendline("yes")
@@ -1056,7 +1056,7 @@ def fence_login(options, re_login_string = "(login\s*: )|(Login Name:  )|(userna
 			except KeyError:
 				fail(EC_PASSWORD_MISSING)
 	except pexpect.EOF:
-		fail(EC_LOGIN_DENIED) 
+		fail(EC_LOGIN_DENIED)
 	except pexpect.TIMEOUT:
 		fail(EC_LOGIN_DENIED)
 	return conn
diff --git a/fence/agents/lpar/fence_lpar.py b/fence/agents/lpar/fence_lpar.py
index 1d7e09c..8a8b50d 100644
--- a/fence/agents/lpar/fence_lpar.py
+++ b/fence/agents/lpar/fence_lpar.py
@@ -4,7 +4,7 @@
 ##
 ## The Following Agent Has Been Tested On:
 ##
-##  Version       
+##  Version
 ## +---------------------------------------------+
 ##  Tested on HMC
 ##
@@ -33,7 +33,7 @@ def get_power_status(conn, options):
 		conn.send("lssyscfg -r lpar -m "+ options["--managed"] +" --filter 'lpar_names=" + options["--plug"] + "'\n")
 		conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 
-		try:				
+		try:
 			status = re.compile(",state=(.*?),", re.IGNORECASE).search(conn.before).group(1)
 		except AttributeError:
 			fail(EC_STATUS_HMC)
@@ -54,14 +54,14 @@ def set_power_status(conn, options):
 		conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 	elif options["--hmc-version"] == "4":
 		if options["--action"] == "on":
-			conn.send("chsysstate -o on -r lpar -m " + options["--managed"] + 
-				" -n " + options["--plug"] + 
+			conn.send("chsysstate -o on -r lpar -m " + options["--managed"] +
+				" -n " + options["--plug"] +
 				" -f `lssyscfg -r lpar -F curr_profile " +
 				" -m " + options["--managed"] +
 				" --filter \"lpar_names="+ options["--plug"] +"\"`\n" )
 		else:
 			conn.send("chsysstate -o shutdown -r lpar --immed" +
-				" -m " + options["--managed"] + " -n " + options["--plug"] + "\n")		
+				" -m " + options["--managed"] + " -n " + options["--plug"] + "\n")
 		conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 
 def get_lpar_list(conn, options):
@@ -76,12 +76,12 @@ def get_lpar_list(conn, options):
 
 		if res == None:
 			fail_usage("Unable to parse output of list command")
-		
+
 		lines = res.group(2).split("\n")
 		for outlet_line in lines:
 			outlets[outlet_line.rstrip()] = ("", "")
 	elif options["--hmc-version"] == "4":
-		conn.send("lssyscfg -r lpar -m " + options["--managed"] + 
+		conn.send("lssyscfg -r lpar -m " + options["--managed"] +
 			" -F name:state\n")
 		conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 
@@ -91,7 +91,7 @@ def get_lpar_list(conn, options):
 
 		if res == None:
 			fail_usage("Unable to parse output of list command")
-		
+
 		lines = res.group(1).split("\n")
 		for outlet_line in lines:
 			(port, status) = outlet_line.split(":")
@@ -113,7 +113,7 @@ def define_new_opts():
 		"help" : "-H, --hmc-version=[version]    Force HMC version to use: 3, 4 (default)",
 		"required" : "0",
 		"shortdesc" : "Force HMC version to use (3 or 4)",
-		"default" : "4", 
+		"default" : "4",
 		"choices" : [ "3", "4" ],
 		"order" : 1 }
 
diff --git a/fence/agents/ovh/fence_ovh.py b/fence/agents/ovh/fence_ovh.py
index 2ec3fa0..7d4b6bc 100644
--- a/fence/agents/ovh/fence_ovh.py
+++ b/fence/agents/ovh/fence_ovh.py
@@ -37,7 +37,7 @@ def netboot_reboot(options, mode):
 
 	# dedicatedNetbootModifyById changes the mode of the next reboot
 	conn.service.dedicatedNetbootModifyById(options["session"], options["--plug"], mode, '', options["--email"])
- 
+
 	# dedicatedHardRebootDo initiates a hard reboot on the given node
 	conn.service.dedicatedHardRebootDo(options["session"], options["--plug"], 'Fencing initiated by cluster', '', 'en')
 
@@ -70,14 +70,14 @@ def soap_login(options):
 		soap = Client(url, doctor=d)
 		session = soap.service.login(options["--username"], options["--password"], 'en', 0)
 	except Exception, ex:
-		fail(EC_LOGIN_DENIED)   
+		fail(EC_LOGIN_DENIED)
 
 	options["session"] = session
 	return soap
 
 def remove_tmp_dir(tmp_dir):
 	shutil.rmtree(tmp_dir)
-	
+
 def main():
 	device_opt = [ "login", "passwd", "port", "email" ]
 
@@ -109,11 +109,11 @@ Poweroff is simulated with a reboot into rescue-pro mode."
 
 	if options["--action"] == 'off':
 		# Reboot in Rescue-pro
-		netboot_reboot(options,OVH_RESCUE_PRO_NETBOOT_ID)
+		netboot_reboot(options, OVH_RESCUE_PRO_NETBOOT_ID)
 		time.sleep(STATUS_RESCUE_PRO_SLEEP)
 	elif options["--action"] in  ['on', 'reboot' ]:
 		# Reboot from HD
-		netboot_reboot(options,OVH_HARD_DISK_NETBOOT_ID)
+		netboot_reboot(options, OVH_HARD_DISK_NETBOOT_ID)
 		time.sleep(STATUS_HARD_DISK_SLEEP)
 
 	# Save datetime just after reboot
@@ -123,11 +123,11 @@ Poweroff is simulated with a reboot into rescue-pro mode."
 	reboot_t = reboot_time(options)
 
 	if options.has_key("--verbose"):
-		options["debug_fh"].write("reboot_start_end.start: "+ reboot_t.start.strftime('%Y-%m-%d %H:%M:%S')+"\n")         
+		options["debug_fh"].write("reboot_start_end.start: "+ reboot_t.start.strftime('%Y-%m-%d %H:%M:%S')+"\n")
 		options["debug_fh"].write("before_netboot_reboot: " + before_netboot_reboot.strftime('%Y-%m-%d %H:%M:%S')+"\n")
-		options["debug_fh"].write("reboot_start_end.end: "  + reboot_t.end.strftime('%Y-%m-%d %H:%M:%S')+"\n")        
-		options["debug_fh"].write("after_netboot_reboot: "  + after_netboot_reboot.strftime('%Y-%m-%d %H:%M:%S')+"\n")  
-                
+		options["debug_fh"].write("reboot_start_end.end: "  + reboot_t.end.strftime('%Y-%m-%d %H:%M:%S')+"\n")
+		options["debug_fh"].write("after_netboot_reboot: "  + after_netboot_reboot.strftime('%Y-%m-%d %H:%M:%S')+"\n")
+
 	if reboot_t.start < after_netboot_reboot < reboot_t.end:
 		result = 0
 		if options.has_key("--verbose"):
diff --git a/fence/agents/rhevm/fence_rhevm.py b/fence/agents/rhevm/fence_rhevm.py
index ff3d19f..1ed05d5 100644
--- a/fence/agents/rhevm/fence_rhevm.py
+++ b/fence/agents/rhevm/fence_rhevm.py
@@ -14,7 +14,7 @@ BUILD_DATE="March, 2008"
 
 RE_GET_ID = re.compile("<vm( .*)? id=\"(.*?)\"", re.IGNORECASE)
 RE_STATUS = re.compile("<state>(.*?)</state>", re.IGNORECASE)
-RE_GET_NAME = re.compile("<name>(.*?)</name>", re.IGNORECASE) 
+RE_GET_NAME = re.compile("<name>(.*?)</name>", re.IGNORECASE)
 
 def get_power_status(conn, options):
 	### Obtain real ID from name
@@ -26,7 +26,7 @@ def get_power_status(conn, options):
 		fail(EC_STATUS)
 
 	options["id"] = result.group(2)
-	
+
 	result = RE_STATUS.search(res)
 	if (result == None):
 		# We were able to parse ID so output is correct
@@ -106,7 +106,7 @@ def main():
 	atexit.register(atexit_handler)
 
 	all_opt["power_wait"]["default"] = "1"
-	
+
 	options = check_input(device_opt, process_input(device_opt))
 
 	docs = { }
diff --git a/fence/agents/rsa/fence_rsa.py b/fence/agents/rsa/fence_rsa.py
index 117dd67..7135573 100644
--- a/fence/agents/rsa/fence_rsa.py
+++ b/fence/agents/rsa/fence_rsa.py
@@ -20,7 +20,7 @@ BUILD_DATE=""
 def get_power_status(conn, options):
 	conn.send_eol("power state")
 	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
-				
+
 	match = re.compile("Power: (.*)", re.IGNORECASE).search(conn.before)
 	if (match != None):
 		status = match.group(1)
@@ -55,7 +55,7 @@ be avoided while a GFS cluster is running because the connection \
 will block any necessary fencing actions."
 	docs["vendorurl"] = "http://www.ibm.com"
 	show_docs(options, docs)
-	
+
 	##
 	## Operate the fencing device
 	######
@@ -70,7 +70,7 @@ will block any necessary fencing actions."
 		conn.close()
 	except:
 		pass
-	
+
 	sys.exit(result)
 
 if __name__ == "__main__":
diff --git a/fence/agents/rsb/fence_rsb.py b/fence/agents/rsb/fence_rsb.py
index da60a61..08af873 100755
--- a/fence/agents/rsb/fence_rsb.py
+++ b/fence/agents/rsb/fence_rsb.py
@@ -70,8 +70,8 @@ will block any necessary fencing actions."
 	##
 	## Logout from system
 	##
-	## In some special unspecified cases it is possible that 
-	## connection will be closed before we run close(). This is not 
+	## In some special unspecified cases it is possible that
+	## connection will be closed before we run close(). This is not
 	## a problem because everything is checked before.
 	######
 	try:
@@ -79,7 +79,7 @@ will block any necessary fencing actions."
 		conn.close()
 	except:
 		pass
-	
+
 	sys.exit(result)
 
 if __name__ == "__main__":
diff --git a/fence/agents/sanbox2/fence_sanbox2.py b/fence/agents/sanbox2/fence_sanbox2.py
index 5221d49..6f320b1 100644
--- a/fence/agents/sanbox2/fence_sanbox2.py
+++ b/fence/agents/sanbox2/fence_sanbox2.py
@@ -34,7 +34,7 @@ def get_power_status(conn, options):
 		except:
 			pass
 		fail(EC_TIMED_OUT)
-	
+
 	status = re.compile(".*AdminState\s+(online|offline)\s+", re.IGNORECASE | re.MULTILINE).search(conn.before).group(1)
 
 	try:
@@ -58,7 +58,7 @@ def set_power_status(conn, options):
 			conn.close()
 		except:
 			pass
-		fail(EC_TIMED_OUT)                                                                         	
+		fail(EC_TIMED_OUT)
 
 	try:
 		conn.send_eol("set port " + options["--plug"] + " state " + action)
@@ -96,7 +96,7 @@ def get_list_devices(conn, options):
 		except:
 			pass
 		fail(EC_TIMED_OUT)
-		
+
 	return outlets
 
 def main():
diff --git a/fence/agents/vmware/fence_vmware.py b/fence/agents/vmware/fence_vmware.py
index dc4ef0f..551337e 100644
--- a/fence/agents/vmware/fence_vmware.py
+++ b/fence/agents/vmware/fence_vmware.py
@@ -326,7 +326,7 @@ This agent supports only vmrun from version 2.0.0 (VIX API 1.6.0)."
 
 	# Operate the fencing device
 	result = fence_action(None, options, set_power_status, get_power_status, get_outlets_status)
-	
+
 	sys.exit(result)
 
 if __name__ == "__main__":
diff --git a/fence/agents/vmware_soap/fence_vmware_soap.py b/fence/agents/vmware_soap/fence_vmware_soap.py
index bbac1c5..7ce9016 100644
--- a/fence/agents/vmware_soap/fence_vmware_soap.py
+++ b/fence/agents/vmware_soap/fence_vmware_soap.py
@@ -23,13 +23,13 @@ def soap_login(options):
 		url = "https://"
 	else:
 		url = "http://"
-	
+
 	url += options["--ip"] + ":" + str(options["--ipport"]) + "/sdk"
 
 	tmp_dir = tempfile.mkdtemp()
 	tempfile.tempdir = tmp_dir
 	atexit.register(remove_tmp_dir, tmp_dir)
-	
+
 	try:
 		conn = Client(url + "/vimService.wsdl")
 		conn.set_options(location = url)
@@ -42,7 +42,7 @@ def soap_login(options):
 
 		SessionManager = conn.service.Login(mo_SessionManager, options["--username"], options["--password"])
 	except Exception, ex:
-		fail(EC_LOGIN_DENIED)	
+		fail(EC_LOGIN_DENIED)
 
 	options["ServiceContent"] = ServiceContent
 	options["mo_SessionManager"] = mo_SessionManager
@@ -125,9 +125,9 @@ def get_power_status(conn, options):
 				## Transform InventoryPath to UUID
 				mo_SearchIndex = Property(options["ServiceContent"].searchIndex.value)
 				mo_SearchIndex._type = "SearchIndex"
-			
+
 				vm = conn.service.FindByInventoryPath(mo_SearchIndex, options["--plug"])
-			
+
 				try:
 					options["--uuid"] = mappingToUUID[vm.value]
 				except KeyError, ex:
@@ -159,7 +159,7 @@ def set_power_status(conn, options):
 
 	mo_machine = Property(vm.value)
 	mo_machine._type = "VirtualMachine"
-	
+
 	try:
 		if options["--action"] == "on":
 			conn.service.PowerOnVM_Task(mo_machine)
@@ -184,7 +184,7 @@ def main():
 
 	options = check_input(device_opt, process_input(device_opt))
 
-	## 
+	##
 	## Fence agent specific defaults
 	#####
 	docs = { }
@@ -207,7 +207,7 @@ Alternatively you can always use UUID to access virtual machine."
 	## Operate the fencing device
 	####
 	conn = soap_login(options)
-		
+
 	result = fence_action(conn, options, set_power_status, get_power_status, get_power_status)
 
 	##
diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py
index d824e7d..227e4b4 100644
--- a/fence/agents/wti/fence_wti.py
+++ b/fence/agents/wti/fence_wti.py
@@ -51,7 +51,7 @@ def get_plug_status(conn, options):
 	status_index = -1
 	plug_header = list()
 	outlets = {}
-	
+
 	for line in listing.splitlines():
 		if (plug_section == 2) and line.find("|") >= 0 and line.startswith("PLUG") == False:
 			plug_line = [x.strip().lower() for x in line.split("|")]
@@ -80,7 +80,7 @@ def get_plug_status(conn, options):
 def get_plug_group_status_from_list(status_list):
 	for status in status_list:
 		if status == "on":
-		      return status
+			return status
 	return "off"
 
 def get_plug_group_status(conn, options):
@@ -108,7 +108,7 @@ def get_plug_group_status(conn, options):
 						line_index = -1
 
 				return get_plug_group_status_from_list(plug_status)
- 
+
 			else:
 				## We already believe that first column contains plug number
 				if len(plug_line[0]) != 0:
@@ -148,7 +148,7 @@ def get_plug_group_status(conn, options):
 
 def get_power_status(conn, options):
 	ret = get_plug_status(conn, options)
-	
+
 	if ret == "PROBLEM":
 		ret = get_plug_group_status(conn, options)
 
@@ -182,12 +182,12 @@ Lengthy telnet connections to the NPS should be avoided while a GFS cluster \
 is running because the connection will block any necessary fencing actions."
 	docs["vendorurl"] = "http://www.wti.com"
 	show_docs(options, docs)
-	
+
 	##
 	## Operate the fencing device
 	##
 	## @note: if it possible that this device does not need either login, password or both of them
-	#####	
+	#####
 	if 0 == options.has_key("--ssh"):
 		try:
 			if options["--action"] in ["off", "reboot"]:
@@ -196,7 +196,7 @@ is running because the connection will block any necessary fencing actions."
 			conn = fspawn(options, TELNET_PATH)
 			conn.send("set binary\n")
 			conn.send("open %s -%s\n"%(options["--ip"], options["--ipport"]))
-			
+
 			re_login = re.compile("(login: )|(Login Name:  )|(username: )|(User Name :)", re.IGNORECASE)
 			re_prompt = re.compile("|".join(map (lambda x: "(" + x + ")", options["--command-prompt"])), re.IGNORECASE)
 
@@ -207,17 +207,17 @@ is running because the connection will block any necessary fencing actions."
 					result = conn.log_expect(options, [ re_login, "Password: ", re_prompt ], int(options["--shell-timeout"]))
 				else:
 					fail_usage("Failed: You have to set login name")
-		
+
 			if result == 1:
 				if options.has_key("--password"):
 					conn.send(options["--password"]+"\r\n")
-					conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))	
+					conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 				else:
 					fail_usage("Failed: You have to enter password or password script")
 		except pexpect.EOF:
-			fail(EC_LOGIN_DENIED) 
+			fail(EC_LOGIN_DENIED)
 		except pexpect.TIMEOUT:
-			fail(EC_LOGIN_DENIED)		
+			fail(EC_LOGIN_DENIED)
 	else:
 		conn = fence_login(options)
 
@@ -231,7 +231,7 @@ is running because the connection will block any necessary fencing actions."
 		conn.close()
 	except:
 		pass
-		
+
 	sys.exit(result)
 
 if __name__ == "__main__":
diff --git a/fence/agents/xenapi/fence_xenapi.py b/fence/agents/xenapi/fence_xenapi.py
index 9cf200a..81ebb96 100644
--- a/fence/agents/xenapi/fence_xenapi.py
+++ b/fence/agents/xenapi/fence_xenapi.py
@@ -8,12 +8,12 @@
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation, either version 2 of the License, or
 # (at your option) any later version.
-# 
+#
 # fence-xenserver is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
@@ -49,7 +49,7 @@ def get_power_fn(session, options):
 		verbose = True
 	else:
 		verbose = False
-		
+
 	try:
 		# Get a reference to the vm specified in the UUID or vm_name/port parameter
 		vm = return_vm_reference(session, options)
@@ -78,7 +78,7 @@ def get_power_fn(session, options):
 # Set the state of the port given in the -U flag of options.
 def set_power_fn(session, options):
 	action = options["--action"].lower()
-	
+
 	try:
 		# Get a reference to the vm specified in the UUID or vm_name/port parameter
 		vm = return_vm_reference(session, options)
@@ -88,7 +88,7 @@ def set_power_fn(session, options):
 		# domain as they show up as VM's with specific properties.
 		if not(record["is_a_template"]) and not(record["is_control_domain"]):
 			if( action == "on" ):
-				# Start the VM 
+				# Start the VM
 				session.xenapi.VM.start(vm, False, True)
 			elif( action == "off" ):
 				# Force shutdown the VM
@@ -141,11 +141,11 @@ def connect_and_login(options):
 	except Exception, exn:
 		print str(exn)
 		# http://sources.redhat.com/cluster/wiki/FenceAgentAPI says that for no connectivity
-		# the exit value should be 1. It doesn't say anything about failed logins, so 
+		# the exit value should be 1. It doesn't say anything about failed logins, so
 		# until I hear otherwise it is best to keep this exit the same to make sure that
 		# anything calling this script (that uses the same information in the web page
 		# above) knows that this is an error condition, not a msg signifying a down port.
-		sys.exit(EC_BAD_SESSION) 
+		sys.exit(EC_BAD_SESSION)
 	return session
 
 # return a reference to the VM by either using the UUID or the vm_name/port. If the UUID is set then
@@ -169,7 +169,6 @@ def return_vm_reference(session, options):
 			if verbose:
 				print "No VM's found with a UUID of \"%s\"" % uuid
 			raise
-		
 
 	# Case where the vm_name/port has been specified
 	if options.has_key("--plug"):
@@ -213,12 +212,12 @@ fence_cxs is an I/O Fencing agent used on Citrix XenServer hosts. \
 It uses the XenAPI, supplied by Citrix, to establish an XML-RPC sesssion \
 to a XenServer host. Once the session is established, further XML-RPC \
 commands are issued in order to switch on, switch off, restart and query \
-the status of virtual machines running on the host." 
+the status of virtual machines running on the host."
 	docs["vendorurl"] = "http://www.xenproject.org"
 	show_docs(options, docs)
 
 	xenSession = connect_and_login(options)
-	
+
 	# Operate the fencing device
 	result = fence_action(xenSession, options, set_power_fn, get_power_fn, get_outlet_list)
 
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Cluster-devel] [PATCH 02/15] [cleanup] Proper import of atexit
  2014-04-02 11:52 [Cluster-devel] [PATCH 01/15] [cleanup] Add missing spaces and fix tab/spaces indentation Marek 'marx' Grac
@ 2014-04-02 11:52 ` Marek 'marx' Grac
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 03/15] [cleanup] Remove unused variables Marek 'marx' Grac
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Marek 'marx' Grac @ 2014-04-02 11:52 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Previously atexit library was imported only from the fencing library.
---
 fence/agents/alom/fence_alom.py                 | 1 +
 fence/agents/amt/fence_amt.py                   | 1 +
 fence/agents/apc/fence_apc.py                   | 1 +
 fence/agents/apc_snmp/fence_apc_snmp.py         | 1 +
 fence/agents/bladecenter/fence_bladecenter.py   | 1 +
 fence/agents/brocade/fence_brocade.py           | 1 +
 fence/agents/cisco_mds/fence_cisco_mds.py       | 1 +
 fence/agents/cisco_ucs/fence_cisco_ucs.py       | 1 +
 fence/agents/drac/fence_drac.py                 | 1 +
 fence/agents/drac5/fence_drac5.py               | 1 +
 fence/agents/dummy/fence_dummy.py               | 1 +
 fence/agents/eaton_snmp/fence_eaton_snmp.py     | 1 +
 fence/agents/eps/fence_eps.py                   | 1 +
 fence/agents/hds_cb/fence_hds_cb.py             | 1 +
 fence/agents/hpblade/fence_hpblade.py           | 1 +
 fence/agents/ibmblade/fence_ibmblade.py         | 1 +
 fence/agents/ifmib/fence_ifmib.py               | 1 +
 fence/agents/ilo/fence_ilo.py                   | 1 +
 fence/agents/ilo_mp/fence_ilo_mp.py             | 1 +
 fence/agents/intelmodular/fence_intelmodular.py | 1 +
 fence/agents/ipdu/fence_ipdu.py                 | 1 +
 fence/agents/ipmilan/fence_ipmilan.py           | 1 +
 fence/agents/ldom/fence_ldom.py                 | 1 +
 fence/agents/lib/fencing.py.py                  | 2 +-
 fence/agents/lpar/fence_lpar.py                 | 1 +
 fence/agents/netio/fence_netio.py               | 1 +
 fence/agents/ovh/fence_ovh.py                   | 1 +
 fence/agents/rhevm/fence_rhevm.py               | 1 +
 fence/agents/rsa/fence_rsa.py                   | 1 +
 fence/agents/rsb/fence_rsb.py                   | 1 +
 fence/agents/sanbox2/fence_sanbox2.py           | 1 +
 fence/agents/virsh/fence_virsh.py               | 1 +
 fence/agents/vmware/fence_vmware.py             | 1 +
 fence/agents/vmware_soap/fence_vmware_soap.py   | 1 +
 fence/agents/wti/fence_wti.py                   | 1 +
 fence/agents/xenapi/fence_xenapi.py             | 1 +
 36 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/fence/agents/alom/fence_alom.py b/fence/agents/alom/fence_alom.py
index 7a7e38e..ae484a4 100644
--- a/fence/agents/alom/fence_alom.py
+++ b/fence/agents/alom/fence_alom.py
@@ -6,6 +6,7 @@
 # as found on SUN T2000 Niagara
 
 import sys, re, pexpect, time, exceptions
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 
diff --git a/fence/agents/amt/fence_amt.py b/fence/agents/amt/fence_amt.py
index 71288e0..55e3e5b 100644
--- a/fence/agents/amt/fence_amt.py
+++ b/fence/agents/amt/fence_amt.py
@@ -1,6 +1,7 @@
 #!/usr/bin/python
 
 import sys, subprocess, re, os, stat
+import atexit
 from pipes import quote
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index da1b6b8..451c616 100644
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -15,6 +15,7 @@
 #####
 
 import sys, re, pexpect, exceptions
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 
diff --git a/fence/agents/apc_snmp/fence_apc_snmp.py b/fence/agents/apc_snmp/fence_apc_snmp.py
index 1e44ae6..971919a 100644
--- a/fence/agents/apc_snmp/fence_apc_snmp.py
+++ b/fence/agents/apc_snmp/fence_apc_snmp.py
@@ -10,6 +10,7 @@
 # - Tripplite PDUMH20HVNET 12.04.0055 - SNMP v1, v2c, v3
 
 import sys
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 from fencing_snmp import *
diff --git a/fence/agents/bladecenter/fence_bladecenter.py b/fence/agents/bladecenter/fence_bladecenter.py
index 6eeaeb4..d3a0301 100644
--- a/fence/agents/bladecenter/fence_bladecenter.py
+++ b/fence/agents/bladecenter/fence_bladecenter.py
@@ -13,6 +13,7 @@
 #####
 
 import sys, re, pexpect, exceptions
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 
diff --git a/fence/agents/brocade/fence_brocade.py b/fence/agents/brocade/fence_brocade.py
index 53b4573..b7a197e 100644
--- a/fence/agents/brocade/fence_brocade.py
+++ b/fence/agents/brocade/fence_brocade.py
@@ -1,6 +1,7 @@
 #!/usr/bin/python
 
 import sys, re, pexpect, exceptions
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 
diff --git a/fence/agents/cisco_mds/fence_cisco_mds.py b/fence/agents/cisco_mds/fence_cisco_mds.py
index 2428dcf..2bd6eae 100644
--- a/fence/agents/cisco_mds/fence_cisco_mds.py
+++ b/fence/agents/cisco_mds/fence_cisco_mds.py
@@ -7,6 +7,7 @@
 #   with BIOS 1.0.16, kickstart 4.1(1c), system 4.1(1c)
 
 import sys, re
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 from fencing_snmp import *
diff --git a/fence/agents/cisco_ucs/fence_cisco_ucs.py b/fence/agents/cisco_ucs/fence_cisco_ucs.py
index 50c1cb8..debefb4 100644
--- a/fence/agents/cisco_ucs/fence_cisco_ucs.py
+++ b/fence/agents/cisco_ucs/fence_cisco_ucs.py
@@ -2,6 +2,7 @@
 
 import sys, re
 import pycurl, StringIO
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 
diff --git a/fence/agents/drac/fence_drac.py b/fence/agents/drac/fence_drac.py
index c2b2acc..90314f4 100644
--- a/fence/agents/drac/fence_drac.py
+++ b/fence/agents/drac/fence_drac.py
@@ -1,6 +1,7 @@
 #!/usr/bin/python
 
 import sys, re, pexpect, exceptions
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 
diff --git a/fence/agents/drac5/fence_drac5.py b/fence/agents/drac5/fence_drac5.py
index 6ce0586..20e2e8a 100644
--- a/fence/agents/drac5/fence_drac5.py
+++ b/fence/agents/drac5/fence_drac5.py
@@ -13,6 +13,7 @@
 #####
 
 import sys, re, pexpect, exceptions, time
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 
diff --git a/fence/agents/dummy/fence_dummy.py b/fence/agents/dummy/fence_dummy.py
index 1f9ddf1..cc136d4 100644
--- a/fence/agents/dummy/fence_dummy.py
+++ b/fence/agents/dummy/fence_dummy.py
@@ -1,6 +1,7 @@
 #!/usr/bin/python
 
 import sys, re, pexpect, exceptions, random
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 
diff --git a/fence/agents/eaton_snmp/fence_eaton_snmp.py b/fence/agents/eaton_snmp/fence_eaton_snmp.py
index 462d541..0497c75 100644
--- a/fence/agents/eaton_snmp/fence_eaton_snmp.py
+++ b/fence/agents/eaton_snmp/fence_eaton_snmp.py
@@ -7,6 +7,7 @@
 #   EATON | Powerware ePDU model: Switched ePDU (IPV3600), firmware: 2.0.K
 
 import sys
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 from fencing_snmp import *
diff --git a/fence/agents/eps/fence_eps.py b/fence/agents/eps/fence_eps.py
index 6f2c6da..6e7cc1e 100644
--- a/fence/agents/eps/fence_eps.py
+++ b/fence/agents/eps/fence_eps.py
@@ -5,6 +5,7 @@
 
 import sys, re
 import httplib, base64, string, socket
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 
diff --git a/fence/agents/hds_cb/fence_hds_cb.py b/fence/agents/hds_cb/fence_hds_cb.py
index 9bdf083..d8046b1 100755
--- a/fence/agents/hds_cb/fence_hds_cb.py
+++ b/fence/agents/hds_cb/fence_hds_cb.py
@@ -11,6 +11,7 @@
 #####
 
 import sys, re, pexpect, exceptions
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 
diff --git a/fence/agents/hpblade/fence_hpblade.py b/fence/agents/hpblade/fence_hpblade.py
index 238e549..e2de148 100644
--- a/fence/agents/hpblade/fence_hpblade.py
+++ b/fence/agents/hpblade/fence_hpblade.py
@@ -7,6 +7,7 @@
 #####
 
 import sys, re, pexpect, exceptions
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 
diff --git a/fence/agents/ibmblade/fence_ibmblade.py b/fence/agents/ibmblade/fence_ibmblade.py
index 1787ae2..4567861 100644
--- a/fence/agents/ibmblade/fence_ibmblade.py
+++ b/fence/agents/ibmblade/fence_ibmblade.py
@@ -1,6 +1,7 @@
 #!/usr/bin/python
 
 import sys
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 from fencing_snmp import *
diff --git a/fence/agents/ifmib/fence_ifmib.py b/fence/agents/ifmib/fence_ifmib.py
index eabcbe9..ec5ab0c 100644
--- a/fence/agents/ifmib/fence_ifmib.py
+++ b/fence/agents/ifmib/fence_ifmib.py
@@ -9,6 +9,7 @@
 #   Only lance if is visible
 
 import sys
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 from fencing_snmp import *
diff --git a/fence/agents/ilo/fence_ilo.py b/fence/agents/ilo/fence_ilo.py
index 779b9a5..a04aacf 100644
--- a/fence/agents/ilo/fence_ilo.py
+++ b/fence/agents/ilo/fence_ilo.py
@@ -12,6 +12,7 @@
 #####
 
 import sys, re, pexpect
+import atexit
 from xml.sax.saxutils import quoteattr
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
diff --git a/fence/agents/ilo_mp/fence_ilo_mp.py b/fence/agents/ilo_mp/fence_ilo_mp.py
index 23aa8cc..5bb234b 100644
--- a/fence/agents/ilo_mp/fence_ilo_mp.py
+++ b/fence/agents/ilo_mp/fence_ilo_mp.py
@@ -1,6 +1,7 @@
 #!/usr/bin/python
 
 import sys, re, pexpect, exceptions
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 
diff --git a/fence/agents/intelmodular/fence_intelmodular.py b/fence/agents/intelmodular/fence_intelmodular.py
index 35091a0..d569d74 100644
--- a/fence/agents/intelmodular/fence_intelmodular.py
+++ b/fence/agents/intelmodular/fence_intelmodular.py
@@ -12,6 +12,7 @@
 # Thanks Matthew Kent for original agent and testing.
 
 import sys
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 from fencing_snmp import *
diff --git a/fence/agents/ipdu/fence_ipdu.py b/fence/agents/ipdu/fence_ipdu.py
index 7f08656..b90a333 100644
--- a/fence/agents/ipdu/fence_ipdu.py
+++ b/fence/agents/ipdu/fence_ipdu.py
@@ -6,6 +6,7 @@
 #
 
 import sys
+import atexit
 sys.path.append("/usr/share/fence")
 from fencing import *
 from fencing_snmp import *
diff --git a/fence/agents/ipmilan/fence_ipmilan.py b/fence/agents/ipmilan/fence_ipmilan.py
index 0cea62b..ab5a75a 100644
--- a/fence/agents/ipmilan/fence_ipmilan.py
+++ b/fence/agents/ipmilan/fence_ipmilan.py
@@ -1,6 +1,7 @@
 #!/usr/bin/python
 
 import sys, shlex, stat, subprocess, re, os
+import atexit
 from pipes import quote
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
diff --git a/fence/agents/ldom/fence_ldom.py b/fence/agents/ldom/fence_ldom.py
index acddffe..1bf1c49 100644
--- a/fence/agents/ldom/fence_ldom.py
+++ b/fence/agents/ldom/fence_ldom.py
@@ -8,6 +8,7 @@
 #####
 
 import sys, re, pexpect, exceptions
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 9ef3c8e..41f9087 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 
 import sys, getopt, time, os, uuid, pycurl, stat
-import pexpect, re, atexit, syslog
+import pexpect, re, syslog
 import __main__
 
 ## do not add code here.
diff --git a/fence/agents/lpar/fence_lpar.py b/fence/agents/lpar/fence_lpar.py
index 8a8b50d..c4237f2 100644
--- a/fence/agents/lpar/fence_lpar.py
+++ b/fence/agents/lpar/fence_lpar.py
@@ -11,6 +11,7 @@
 #####
 
 import sys, re, pexpect, exceptions
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 
diff --git a/fence/agents/netio/fence_netio.py b/fence/agents/netio/fence_netio.py
index 3cbf489..71c3014 100755
--- a/fence/agents/netio/fence_netio.py
+++ b/fence/agents/netio/fence_netio.py
@@ -1,6 +1,7 @@
 #!/usr/bin/python
 
 import sys, re, pexpect, exceptions
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 
diff --git a/fence/agents/ovh/fence_ovh.py b/fence/agents/ovh/fence_ovh.py
index 7d4b6bc..6becd8e 100644
--- a/fence/agents/ovh/fence_ovh.py
+++ b/fence/agents/ovh/fence_ovh.py
@@ -10,6 +10,7 @@
 
 import sys, time
 import shutil, tempfile
+import atexit
 from datetime import datetime
 from suds.client import Client
 from suds.xsd.doctor import ImportDoctor, Import
diff --git a/fence/agents/rhevm/fence_rhevm.py b/fence/agents/rhevm/fence_rhevm.py
index 1ed05d5..e4a11de 100644
--- a/fence/agents/rhevm/fence_rhevm.py
+++ b/fence/agents/rhevm/fence_rhevm.py
@@ -2,6 +2,7 @@
 
 import sys, re
 import pycurl, StringIO
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 
diff --git a/fence/agents/rsa/fence_rsa.py b/fence/agents/rsa/fence_rsa.py
index 7135573..992c5e6 100644
--- a/fence/agents/rsa/fence_rsa.py
+++ b/fence/agents/rsa/fence_rsa.py
@@ -8,6 +8,7 @@
 #####
 
 import sys, re, pexpect, exceptions
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 
diff --git a/fence/agents/rsb/fence_rsb.py b/fence/agents/rsb/fence_rsb.py
index 08af873..6c5e119 100755
--- a/fence/agents/rsb/fence_rsb.py
+++ b/fence/agents/rsb/fence_rsb.py
@@ -1,6 +1,7 @@
 #!/usr/bin/python
 
 import sys, re, pexpect, exceptions
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 
diff --git a/fence/agents/sanbox2/fence_sanbox2.py b/fence/agents/sanbox2/fence_sanbox2.py
index 6f320b1..86b646b 100644
--- a/fence/agents/sanbox2/fence_sanbox2.py
+++ b/fence/agents/sanbox2/fence_sanbox2.py
@@ -9,6 +9,7 @@
 #####
 
 import sys, re, pexpect, exceptions
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 
diff --git a/fence/agents/virsh/fence_virsh.py b/fence/agents/virsh/fence_virsh.py
index 1ec5310..0ebf668 100644
--- a/fence/agents/virsh/fence_virsh.py
+++ b/fence/agents/virsh/fence_virsh.py
@@ -6,6 +6,7 @@
 #
 
 import sys, re, pexpect, exceptions
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 
diff --git a/fence/agents/vmware/fence_vmware.py b/fence/agents/vmware/fence_vmware.py
index 551337e..c6209e8 100644
--- a/fence/agents/vmware/fence_vmware.py
+++ b/fence/agents/vmware/fence_vmware.py
@@ -23,6 +23,7 @@
 #
 
 import sys, re, pexpect, exceptions
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 
diff --git a/fence/agents/vmware_soap/fence_vmware_soap.py b/fence/agents/vmware_soap/fence_vmware_soap.py
index 7ce9016..cd56f9f 100644
--- a/fence/agents/vmware_soap/fence_vmware_soap.py
+++ b/fence/agents/vmware_soap/fence_vmware_soap.py
@@ -3,6 +3,7 @@
 import sys, exceptions, time
 import shutil, tempfile, suds
 import logging
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 
 from suds.client import Client
diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py
index 227e4b4..5157335 100644
--- a/fence/agents/wti/fence_wti.py
+++ b/fence/agents/wti/fence_wti.py
@@ -12,6 +12,7 @@
 #####
 
 import sys, re, pexpect, exceptions
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 
diff --git a/fence/agents/xenapi/fence_xenapi.py b/fence/agents/xenapi/fence_xenapi.py
index 81ebb96..509dd8b 100644
--- a/fence/agents/xenapi/fence_xenapi.py
+++ b/fence/agents/xenapi/fence_xenapi.py
@@ -32,6 +32,7 @@
 # whether I should continue support for it. mattjclark0407 at hotmail dot com
 
 import sys
+import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 import XenAPI
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Cluster-devel] [PATCH 03/15] [cleanup] Remove unused variables
  2014-04-02 11:52 [Cluster-devel] [PATCH 01/15] [cleanup] Add missing spaces and fix tab/spaces indentation Marek 'marx' Grac
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 02/15] [cleanup] Proper import of atexit Marek 'marx' Grac
@ 2014-04-02 11:52 ` Marek 'marx' Grac
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 04/15] [cleanup] Split lines that were too long Marek 'marx' Grac
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Marek 'marx' Grac @ 2014-04-02 11:52 UTC (permalink / raw)
  To: cluster-devel.redhat.com

---
 fence/agents/apc/fence_apc.py                   |  3 +--
 fence/agents/brocade/fence_brocade.py           |  2 +-
 fence/agents/cisco_mds/fence_cisco_mds.py       |  2 +-
 fence/agents/cisco_ucs/fence_cisco_ucs.py       |  2 +-
 fence/agents/eps/fence_eps.py                   |  2 +-
 fence/agents/ifmib/fence_ifmib.py               |  2 +-
 fence/agents/intelmodular/fence_intelmodular.py |  2 +-
 fence/agents/lib/fencing.py.py                  |  3 +--
 fence/agents/netio/fence_netio.py               |  2 +-
 fence/agents/ovh/fence_ovh.py                   |  2 +-
 fence/agents/rhevm/fence_rhevm.py               |  2 +-
 fence/agents/vmware_soap/fence_vmware_soap.py   | 20 ++++++++++----------
 fence/agents/wti/fence_wti.py                   |  2 --
 fence/agents/xenapi/fence_xenapi.py             |  2 +-
 14 files changed, 22 insertions(+), 26 deletions(-)

diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index 451c616..71a3d3e 100644
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -175,12 +175,11 @@ def set_power_status(conn, options):
 	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 
 def get_power_status5(conn, options):
-	exp_result = 0
 	outlets = {}
 
 	conn.send_eol("olStatus all")
 
-	exp_result = conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
+	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 	lines = conn.before.split("\n")
 
 	show_re = re.compile('^\s*(\d+): (.*): (On|Off)\s*$', re.IGNORECASE)
diff --git a/fence/agents/brocade/fence_brocade.py b/fence/agents/brocade/fence_brocade.py
index b7a197e..018f3c0 100644
--- a/fence/agents/brocade/fence_brocade.py
+++ b/fence/agents/brocade/fence_brocade.py
@@ -14,7 +14,7 @@ BUILD_DATE="March, 20013"
 def get_power_status(conn, options):
 	conn.send_eol("portCfgShow " + options["--plug"])
 
-	exp_result = conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
+	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 
 	show_re = re.compile('^\s*Persistent Disable\s*(ON|OFF)\s*$', re.IGNORECASE)
 	lines = conn.before.split("\n")
diff --git a/fence/agents/cisco_mds/fence_cisco_mds.py b/fence/agents/cisco_mds/fence_cisco_mds.py
index 2bd6eae..f6eed64 100644
--- a/fence/agents/cisco_mds/fence_cisco_mds.py
+++ b/fence/agents/cisco_mds/fence_cisco_mds.py
@@ -44,7 +44,7 @@ def cisco_port2oid(port):
 		fail_usage("Mangled port number: %s"%(port))
 
 def get_power_status(conn, options):
-	(oid, status) = conn.get(PORT_OID)
+	(_, status) = conn.get(PORT_OID)
 	return (status=="1" and "on" or "off")
 
 def set_power_status(conn, options):
diff --git a/fence/agents/cisco_ucs/fence_cisco_ucs.py b/fence/agents/cisco_ucs/fence_cisco_ucs.py
index debefb4..9a8ed90 100644
--- a/fence/agents/cisco_ucs/fence_cisco_ucs.py
+++ b/fence/agents/cisco_ucs/fence_cisco_ucs.py
@@ -40,7 +40,7 @@ def set_power_status(conn, options):
 		'off' : "down"
 	}[options["--action"]]
 
-	res = send_command(options, \
+	send_command(options, \
 		"<configConfMos cookie=\"" + options["cookie"] + "\" inHierarchical=\"no\">" + \
 		"<inConfigs><pair key=\"org-root" + options["--suborg"] + "/ls-" + options["--plug"] + "/power\">" + \
 		"<lsPower dn=\"org-root/ls-" + options["--plug"] + "/power\" state=\"" + action + "\" status=\"modified\" />" + \
diff --git a/fence/agents/eps/fence_eps.py b/fence/agents/eps/fence_eps.py
index 6e7cc1e..bd43e58 100644
--- a/fence/agents/eps/fence_eps.py
+++ b/fence/agents/eps/fence_eps.py
@@ -83,7 +83,7 @@ def get_power_status(conn, options):
 		return result
 
 def set_power_status(conn, options):
-	ret_val = eps_run_command(options, "P%s=%s"%(options["--plug"], (options["--action"]=="on" and "1" or "0")))
+	eps_run_command(options, "P%s=%s"%(options["--plug"], (options["--action"]=="on" and "1" or "0")))
 
 # Define new option
 def eps_define_new_opts():
diff --git a/fence/agents/ifmib/fence_ifmib.py b/fence/agents/ifmib/fence_ifmib.py
index ec5ab0c..e7d1fa5 100644
--- a/fence/agents/ifmib/fence_ifmib.py
+++ b/fence/agents/ifmib/fence_ifmib.py
@@ -62,7 +62,7 @@ def get_power_status(conn, options):
 	if (port_num==None):
 		port_num = port2index(conn, options["--plug"])
 
-	(oid, status) = conn.get("%s.%d"%(STATUSES_OID, port_num))
+	(_, status) = conn.get("%s.%d"%(STATUSES_OID, port_num))
 	return (status==str(STATUS_UP) and "on" or "off")
 
 def set_power_status(conn, options):
diff --git a/fence/agents/intelmodular/fence_intelmodular.py b/fence/agents/intelmodular/fence_intelmodular.py
index d569d74..3d90707 100644
--- a/fence/agents/intelmodular/fence_intelmodular.py
+++ b/fence/agents/intelmodular/fence_intelmodular.py
@@ -39,7 +39,7 @@ STATUS_SET_OFF = 3
 ### FUNCTIONS ###
 
 def get_power_status(conn, options):
-	(oid, status) = conn.get("%s.%s"% (STATUSES_OID, options["--plug"]))
+	(_, status) = conn.get("%s.%s"% (STATUSES_OID, options["--plug"]))
 	return (status==str(STATUS_UP) and "on" or "off")
 
 def set_power_status(conn, options):
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 41f9087..be925d2 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -461,7 +461,7 @@ def metadata(avail_opt, options, docs):
 	if docs.has_key("vendorurl"):
 		print "<vendor-url>" + docs["vendorurl"] + "</vendor-url>"
 	print "<parameters>"
-	for option, _value in sorted_list:
+	for option, _ in sorted_list:
 		if all_opt[option].has_key("shortdesc"):
 			print "\t<parameter name=\"" + option + "\" unique=\"0\" required=\"" + all_opt[option]["required"] + "\">"
 
@@ -918,7 +918,6 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
 					# fence action was completed succesfully even in that case
 					sys.stderr.write(str(ex))
 					syslog.syslog(syslog.LOG_NOTICE, str(ex))
-					pass
 
 			if power_on == False:
 				# this should not fail as node was fenced succesfully
diff --git a/fence/agents/netio/fence_netio.py b/fence/agents/netio/fence_netio.py
index 71c3014..5902e2e 100755
--- a/fence/agents/netio/fence_netio.py
+++ b/fence/agents/netio/fence_netio.py
@@ -84,7 +84,7 @@ block any necessary fencing actions."
 		conn.send("set binary\n")
 		conn.send("open %s -%s\n"%(options["--ip"], options["--ipport"]))
 
-		screen = conn.read_nonblocking(size=100, timeout=int(options["--shell-timeout"]))
+		conn.read_nonblocking(size=100, timeout=int(options["--shell-timeout"]))
 		conn.log_expect(options, "100 HELLO .*", int(options["--shell-timeout"]))
 		conn.send_eol("login %s %s" % (options["--username"], options["--password"]))
 		conn.log_expect(options, "250 OK", int(options["--shell-timeout"]))
diff --git a/fence/agents/ovh/fence_ovh.py b/fence/agents/ovh/fence_ovh.py
index 6becd8e..4d2d9cb 100644
--- a/fence/agents/ovh/fence_ovh.py
+++ b/fence/agents/ovh/fence_ovh.py
@@ -70,7 +70,7 @@ def soap_login(options):
 	try:
 		soap = Client(url, doctor=d)
 		session = soap.service.login(options["--username"], options["--password"], 'en', 0)
-	except Exception, ex:
+	except Exception:
 		fail(EC_LOGIN_DENIED)
 
 	options["session"] = session
diff --git a/fence/agents/rhevm/fence_rhevm.py b/fence/agents/rhevm/fence_rhevm.py
index e4a11de..9620c3a 100644
--- a/fence/agents/rhevm/fence_rhevm.py
+++ b/fence/agents/rhevm/fence_rhevm.py
@@ -49,7 +49,7 @@ def set_power_status(conn, options):
 	}[options["--action"]]
 
 	url = "vms/" + options["id"] + "/" + action
-	res = send_command(options, url, "POST")
+	send_command(options, url, "POST")
 
 def get_list(conn, options):
 	outlets = { }
diff --git a/fence/agents/vmware_soap/fence_vmware_soap.py b/fence/agents/vmware_soap/fence_vmware_soap.py
index cd56f9f..8110c9e 100644
--- a/fence/agents/vmware_soap/fence_vmware_soap.py
+++ b/fence/agents/vmware_soap/fence_vmware_soap.py
@@ -41,8 +41,8 @@ def soap_login(options):
 		mo_SessionManager = Property(ServiceContent.sessionManager.value)
 		mo_SessionManager._type = 'SessionManager'
 
-		SessionManager = conn.service.Login(mo_SessionManager, options["--username"], options["--password"])
-	except Exception, ex:
+		conn.service.Login(mo_SessionManager, options["--username"], options["--password"])
+	except Exception:
 		fail(EC_LOGIN_DENIED)
 
 	options["ServiceContent"] = ServiceContent
@@ -99,7 +99,7 @@ def get_power_status(conn, options):
 
 	try:
 		raw_machines = conn.service.RetrievePropertiesEx(mo_PropertyCollector, propFilterSpec)
-	except Exception, ex:
+	except Exception:
 		fail(EC_STATUS)
 
 	(machines, uuid, mappingToUUID) = process_results(raw_machines, {}, {}, {})
@@ -108,7 +108,7 @@ def get_power_status(conn, options):
 	while (hasattr(raw_machines, 'token') == True):
 		try:
 			raw_machines = conn.service.ContinueRetrievePropertiesEx(mo_PropertyCollector, raw_machines.token)
-		except Exception, ex:
+		except Exception:
 			fail(EC_STATUS)
 		(more_machines, more_uuid, more_mappingToUUID) = process_results(raw_machines, {}, {}, {})
 		machines.update(more_machines)
@@ -131,18 +131,18 @@ def get_power_status(conn, options):
 
 				try:
 					options["--uuid"] = mappingToUUID[vm.value]
-				except KeyError, ex:
+				except KeyError:
 					fail(EC_STATUS)
-				except AttributeError, ex:
+				except AttributeError:
 					fail(EC_STATUS)
 			else:
 				## Name of virtual machine instead of path
 				## warning: if you have same names of machines this won't work correctly
 				try:
 					(options["--uuid"], _) = machines[options["--plug"]]
-				except KeyError, ex:
+				except KeyError:
 					fail(EC_STATUS)
-				except AttributeError, ex:
+				except AttributeError:
 					fail(EC_STATUS)
 
 		try:
@@ -150,7 +150,7 @@ def get_power_status(conn, options):
 				return "on"
 			else:
 				return "off"
-		except KeyError, ex:
+		except KeyError:
 			fail(EC_STATUS)
 
 def set_power_status(conn, options):
@@ -216,7 +216,7 @@ Alternatively you can always use UUID to access virtual machine."
 	#####
 	try:
 		conn.service.Logout(options["mo_SessionManager"])
-	except Exception, ex:
+	except Exception:
 		pass
 
 	sys.exit(result)
diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py
index 5157335..9b7aa39 100644
--- a/fence/agents/wti/fence_wti.py
+++ b/fence/agents/wti/fence_wti.py
@@ -87,9 +87,7 @@ def get_plug_group_status_from_list(status_list):
 def get_plug_group_status(conn, options):
 	listing = get_listing(conn, options, "/SG")
 
-	plug_section = 0
 	outlets = {}
-	current_outlet = ""
 	line_index = 0
 	lines = listing.splitlines()
 	while line_index < len(lines) and line_index >= 0:
diff --git a/fence/agents/xenapi/fence_xenapi.py b/fence/agents/xenapi/fence_xenapi.py
index 509dd8b..8b9857c 100644
--- a/fence/agents/xenapi/fence_xenapi.py
+++ b/fence/agents/xenapi/fence_xenapi.py
@@ -166,7 +166,7 @@ def return_vm_reference(session, options):
 		# need to catch and re-raise the exception produced by get_by_uuid.
 		try:
 			return session.xenapi.VM.get_by_uuid(uuid)
-		except Exception, exn:
+		except Exception:
 			if verbose:
 				print "No VM's found with a UUID of \"%s\"" % uuid
 			raise
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Cluster-devel] [PATCH 04/15] [cleanup] Split lines that were too long
  2014-04-02 11:52 [Cluster-devel] [PATCH 01/15] [cleanup] Add missing spaces and fix tab/spaces indentation Marek 'marx' Grac
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 02/15] [cleanup] Proper import of atexit Marek 'marx' Grac
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 03/15] [cleanup] Remove unused variables Marek 'marx' Grac
@ 2014-04-02 11:52 ` Marek 'marx' Grac
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 05/15] [cleanup] Remove unused dependencies Marek 'marx' Grac
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Marek 'marx' Grac @ 2014-04-02 11:52 UTC (permalink / raw)
  To: cluster-devel.redhat.com

---
 fence/agents/amt/fence_amt.py                   |  3 +-
 fence/agents/apc/fence_apc.py                   |  6 ++-
 fence/agents/apc_snmp/fence_apc_snmp.py         | 15 +++---
 fence/agents/cisco_ucs/fence_cisco_ucs.py       | 29 ++++++-----
 fence/agents/drac5/fence_drac5.py               |  3 +-
 fence/agents/eaton_snmp/fence_eaton_snmp.py     |  3 +-
 fence/agents/ibmblade/fence_ibmblade.py         |  3 +-
 fence/agents/ilo/fence_ilo.py                   |  6 ++-
 fence/agents/intelmodular/fence_intelmodular.py |  3 +-
 fence/agents/ipmilan/fence_ipmilan.py           |  3 +-
 fence/agents/lib/fencing.py.py                  | 67 +++++++++++++++++--------
 fence/agents/lib/fencing_snmp.py.py             | 19 ++++---
 fence/agents/lpar/fence_lpar.py                 |  6 ++-
 fence/agents/ovh/fence_ovh.py                   | 15 ++++--
 fence/agents/sanbox2/fence_sanbox2.py           |  3 +-
 fence/agents/virsh/fence_virsh.py               |  6 ++-
 fence/agents/vmware/fence_vmware.py             | 15 ++++--
 fence/agents/vmware_soap/fence_vmware_soap.py   |  3 +-
 fence/agents/wti/fence_wti.py                   | 10 ++--
 19 files changed, 140 insertions(+), 78 deletions(-)

diff --git a/fence/agents/amt/fence_amt.py b/fence/agents/amt/fence_amt.py
index 55e3e5b..51022ee 100644
--- a/fence/agents/amt/fence_amt.py
+++ b/fence/agents/amt/fence_amt.py
@@ -103,7 +103,8 @@ def define_new_opts():
 	all_opt["boot_option"] = {
 		"getopt" : "b:",
 		"longopt" : "boot-option",
-		"help" : "-b, --boot-option=[option]     Change the default boot behavior of the machine. (pxe|hd|hdsafe|cd|diag)",
+		"help" : "-b, --boot-option=[option]     "
+				"Change the default boot behavior of the machine. (pxe|hd|hdsafe|cd|diag)",
 		"required" : "0",
 		"shortdesc" : "Change the default boot behavior of the machine.",
 		"choices" : ["pxe", "hd", "hdsafe", "cd", "diag"],
diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index 71a3d3e..b97bbff 100644
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -69,7 +69,8 @@ def get_power_status(conn, options):
 		conn.send_eol(options["--switch"])
 
 	while True:
-		exp_result = conn.log_expect(options, ["Press <ENTER>" ] + options["--command-prompt"], int(options["--shell-timeout"]))
+		exp_result = conn.log_expect(options,
+				["Press <ENTER>" ] + options["--command-prompt"], int(options["--shell-timeout"]))
 		lines = conn.before.split("\n")
 		show_re = re.compile('(^|\x0D)\s*(\d+)- (.*?)\s+(ON|OFF)\s*')
 		for x in lines:
@@ -147,7 +148,8 @@ def set_power_status(conn, options):
 	else:
 		conn.send_eol(options["--switch"])
 
-	while 0 == conn.log_expect(options, [ "Press <ENTER>" ] + options["--command-prompt"], int(options["--shell-timeout"])):
+	while 0 == conn.log_expect(options,
+			[ "Press <ENTER>" ] + options["--command-prompt"], int(options["--shell-timeout"])):
 		conn.send_eol("")
 
 	conn.send_eol(options["--plug"]+"")
diff --git a/fence/agents/apc_snmp/fence_apc_snmp.py b/fence/agents/apc_snmp/fence_apc_snmp.py
index 971919a..b07d04a 100644
--- a/fence/agents/apc_snmp/fence_apc_snmp.py
+++ b/fence/agents/apc_snmp/fence_apc_snmp.py
@@ -1,12 +1,15 @@
 #!/usr/bin/python
 
 # The Following agent has been tested on:
-# - APC Switched Rack PDU (MB:v3.7.0 PF:v2.7.0 PN:apc_hw02_aos_270.bin AF1:v2.7.3 AN1:apc_hw02_aos_270.bin
-#    AF1:v2.7.3 AN1:apc_hw02_rpdu_273.bin MN:AP7930 HR:B2) - SNMP v1
-# - APC Web/SNMP Management Card (MB:v3.8.6 PF:v3.5.8 PN:apc_hw02_aos_358.bin AF1:v3.5.7 AN1:apc_hw02_aos_358.bin
-#    AF1:v3.5.7 AN1:apc_hw02_rpdu_357.bin MN:AP7900 HR:B2) - SNMP v1 and v3 (noAuthNoPrivacy,authNoPrivacy, authPrivacy)
-# - APC Switched Rack PDU (MB:v3.7.0 PF:v2.7.0 PN:apc_hw02_aos_270.bin AF1:v2.7.3 AN1:apc_hw02_rpdu_273.bin
-#    MN:AP7951 HR:B2) - SNMP v1
+# - APC Switched Rack PDU - SNMP v1
+#	(MB:v3.7.0 PF:v2.7.0 PN:apc_hw02_aos_270.bin AF1:v2.7.3
+#	AN1:apc_hw02_aos_270.bin AF1:v2.7.3 AN1:apc_hw02_rpdu_273.bin MN:AP7930 HR:B2)
+# - APC Web/SNMP Management Card - SNMP v1 and v3 (noAuthNoPrivacy,authNoPrivacy, authPrivacy)
+#	(MB:v3.8.6 PF:v3.5.8 PN:apc_hw02_aos_358.bin AF1:v3.5.7
+#       AN1:apc_hw02_aos_358.bin AF1:v3.5.7 AN1:apc_hw02_rpdu_357.bin MN:AP7900 HR:B2)
+# - APC Switched Rack PDU - SNMP v1
+#       (MB:v3.7.0 PF:v2.7.0 PN:apc_hw02_aos_270.bin AF1:v2.7.3
+#       AN1:apc_hw02_rpdu_273.bin MN:AP7951 HR:B2)
 # - Tripplite PDUMH20HVNET 12.04.0055 - SNMP v1, v2c, v3
 
 import sys
diff --git a/fence/agents/cisco_ucs/fence_cisco_ucs.py b/fence/agents/cisco_ucs/fence_cisco_ucs.py
index 9a8ed90..388eda9 100644
--- a/fence/agents/cisco_ucs/fence_cisco_ucs.py
+++ b/fence/agents/cisco_ucs/fence_cisco_ucs.py
@@ -18,10 +18,9 @@ RE_GET_DN = re.compile(" dn=\"(.*?)\"", re.IGNORECASE)
 RE_GET_DESC = re.compile(" descr=\"(.*?)\"", re.IGNORECASE)
 
 def get_power_status(conn, options):
-	res = send_command(options, \
-		"<configResolveDn cookie=\"" + options["cookie"] + "\" inHierarchical=\"false\" dn=\"org-root" + options["--suborg"] + \
-		"/ls-" + options["--plug"] + "/power\"/>", \
-		 int(options["--shell-timeout"]))
+	res = send_command(options, "<configResolveDn cookie=\"" + options["cookie"] +
+			"\" inHierarchical=\"false\" dn=\"org-root" + options["--suborg"] + "/ls-" +
+			options["--plug"] + "/power\"/>", int(options["--shell-timeout"]))
 
 	result = RE_STATUS.search(res)
 	if (result == None):
@@ -40,12 +39,11 @@ def set_power_status(conn, options):
 		'off' : "down"
 	}[options["--action"]]
 
-	send_command(options, \
-		"<configConfMos cookie=\"" + options["cookie"] + "\" inHierarchical=\"no\">" + \
-		"<inConfigs><pair key=\"org-root" + options["--suborg"] + "/ls-" + options["--plug"] + "/power\">" + \
-		"<lsPower dn=\"org-root/ls-" + options["--plug"] + "/power\" state=\"" + action + "\" status=\"modified\" />" + \
-		"</pair></inConfigs></configConfMos>", \
-		int(options["--shell-timeout"]))
+	send_command(options, "<configConfMos cookie=\"" + options["cookie"] + "\" inHierarchical=\"no\">" +
+			"<inConfigs><pair key=\"org-root" + options["--suborg"] + "/ls-" + options["--plug"] +
+			"/power\">" + "<lsPower dn=\"org-root/ls-" + options["--plug"] + "/power\" state=\"" +
+			action + "\" status=\"modified\" />" + "</pair></inConfigs></configConfMos>",
+			int(options["--shell-timeout"]))
 
 	return
 
@@ -53,9 +51,8 @@ def get_list(conn, options):
 	outlets = { }
 
 	try:
-		res = send_command(options, \
-			"<configResolveClass cookie=\"" + options["cookie"] + "\" inHierarchical=\"false\" classId=\"lsServer\"/>", \
-			int(options["--shell-timeout"]))
+		res = send_command(options, "<configResolveClass cookie=\"" + options["cookie"] +
+				"\" inHierarchical=\"false\" classId=\"lsServer\"/>", int(options["--shell-timeout"]))
 
 		lines = res.split("<lsServer ")
 		for i in range(1, len(lines)):
@@ -130,7 +127,8 @@ used with Cisco UCS to fence machines."
 
 	### Login
 	try:
-		res = send_command(options, "<aaaLogin inName=\"" + options["--username"] + "\" inPassword=\"" + options["--password"] + "\" />", int(options["--login-timeout"]))
+		res = send_command(options, "<aaaLogin inName=\"" + options["--username"] +
+				"\" inPassword=\"" + options["--password"] + "\" />", int(options["--login-timeout"]))
 		result = RE_COOKIE.search(res)
 		if (result == None):
 			## Cookie is absenting in response
@@ -151,7 +149,8 @@ used with Cisco UCS to fence machines."
 	result = fence_action(None, options, set_power_status, get_power_status, get_list)
 
 	### Logout; we do not care about result as we will end in any case
-	send_command(options, "<aaaLogout inCookie=\"" + options["cookie"] + "\" />", int(options["--shell-timeout"]))
+	send_command(options, "<aaaLogout inCookie=\"" + options["cookie"] + "\" />",
+			int(options["--shell-timeout"]))
 
 	sys.exit(result)
 
diff --git a/fence/agents/drac5/fence_drac5.py b/fence/agents/drac5/fence_drac5.py
index 20e2e8a..036f294 100644
--- a/fence/agents/drac5/fence_drac5.py
+++ b/fence/agents/drac5/fence_drac5.py
@@ -34,7 +34,8 @@ def get_power_status(conn, options):
 
 		conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 
-		status = re.compile("(^|: )(ON|OFF|Powering ON|Powering OFF)\s*$", re.IGNORECASE | re.MULTILINE).search(conn.before).group(2)
+		status = re.compile("(^|: )(ON|OFF|Powering ON|Powering OFF)\s*$",
+				re.IGNORECASE | re.MULTILINE).search(conn.before).group(2)
 
 	if status.lower().strip() in ["on", "powering on", "powering off"]:
 		return "on"
diff --git a/fence/agents/eaton_snmp/fence_eaton_snmp.py b/fence/agents/eaton_snmp/fence_eaton_snmp.py
index 0497c75..a329aeb 100644
--- a/fence/agents/eaton_snmp/fence_eaton_snmp.py
+++ b/fence/agents/eaton_snmp/fence_eaton_snmp.py
@@ -177,7 +177,8 @@ def get_outlets_status(conn, options):
 		# Plug indexing start from zero, so we substract '1' from the
 		# user's given plug number
 		if (device.ident_str == "Eaton Managed ePDU"):
-			port_num = str(int(((device.has_switches) and "%s:%s"%(t[len(t)-3], t[len(t)-1]) or "%s"%(t[len(t)-1]))) + 1)
+			port_num = str(int(((device.has_switches) and
+					"%s:%s"%(t[len(t)-3], t[len(t)-1]) or "%s"%(t[len(t)-1]))) + 1)
 
 			# Plug indexing start from zero, so we add '1'
 			# for the user's exposed plug number
diff --git a/fence/agents/ibmblade/fence_ibmblade.py b/fence/agents/ibmblade/fence_ibmblade.py
index 4567861..1e60e7d 100644
--- a/fence/agents/ibmblade/fence_ibmblade.py
+++ b/fence/agents/ibmblade/fence_ibmblade.py
@@ -32,7 +32,8 @@ def get_power_status(conn, options):
 	return (status == str(STATUS_UP) and "on" or "off")
 
 def set_power_status(conn, options):
-	conn.set("%s.%s"%(CONTROL_OID, options["--plug"]), (options["--action"]=="on" and STATUS_SET_ON or STATUS_SET_OFF))
+	conn.set("%s.%s"%(CONTROL_OID, options["--plug"]),
+			(options["--action"]=="on" and STATUS_SET_ON or STATUS_SET_OFF))
 
 def get_outlets_status(conn, _):
 	result = {}
diff --git a/fence/agents/ilo/fence_ilo.py b/fence/agents/ilo/fence_ilo.py
index a04aacf..48c829d 100644
--- a/fence/agents/ilo/fence_ilo.py
+++ b/fence/agents/ilo/fence_ilo.py
@@ -110,8 +110,10 @@ the iLO card through an XML stream."
 			conn.send("</RIB_INFO>\r\n")
 			conn.log_expect(options, "<GET_FW_VERSION\s*\n", int(options["--shell-timeout"]))
 			conn.log_expect(options, "/>", int(options["--shell-timeout"]))
-			options["fw_version"] = float(re.compile("FIRMWARE_VERSION\s*=\s*\"(.*?)\"", re.IGNORECASE).search(conn.before).group(1))
-			options["fw_processor"] = re.compile("MANAGEMENT_PROCESSOR\s*=\s*\"(.*?)\"", re.IGNORECASE).search(conn.before).group(1)
+			options["fw_version"] = float(re.compile("FIRMWARE_VERSION\s*=\s*\"(.*?)\"",
+					re.IGNORECASE).search(conn.before).group(1))
+			options["fw_processor"] = re.compile("MANAGEMENT_PROCESSOR\s*=\s*\"(.*?)\"",
+					re.IGNORECASE).search(conn.before).group(1)
 		conn.send("</LOGIN>\r\n")
 	except pexpect.TIMEOUT:
 		fail(EC_LOGIN_DENIED)
diff --git a/fence/agents/intelmodular/fence_intelmodular.py b/fence/agents/intelmodular/fence_intelmodular.py
index 3d90707..bd1faee 100644
--- a/fence/agents/intelmodular/fence_intelmodular.py
+++ b/fence/agents/intelmodular/fence_intelmodular.py
@@ -43,7 +43,8 @@ def get_power_status(conn, options):
 	return (status==str(STATUS_UP) and "on" or "off")
 
 def set_power_status(conn, options):
-	conn.set("%s.%s"%(STATUSES_OID, options["--plug"]), (options["--action"]=="on" and STATUS_SET_ON or STATUS_SET_OFF))
+	conn.set("%s.%s" % (STATUSES_OID, options["--plug"]),
+			(options["--action"]=="on" and STATUS_SET_ON or STATUS_SET_OFF))
 
 def get_outlets_status(conn, options):
 	result = {}
diff --git a/fence/agents/ipmilan/fence_ipmilan.py b/fence/agents/ipmilan/fence_ipmilan.py
index ab5a75a..7b37194 100644
--- a/fence/agents/ipmilan/fence_ipmilan.py
+++ b/fence/agents/ipmilan/fence_ipmilan.py
@@ -143,7 +143,8 @@ def define_new_opts():
 	all_opt["privlvl"] = {
 		"getopt" : "L:",
 		"longopt" : "privlvl",
-		"help" : "-L, --privlvl=[level]          Privilege level on IPMI device (callback|user|operator|administrator)",
+		"help" : "-L, --privlvl=[level]          "
+				"Privilege level on IPMI device (callback|user|operator|administrator)",
 		"required" : "0",
 		"shortdesc" : "Privilege level on IPMI device",
 		"default" : "administrator",
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index be925d2..a713dc8 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -173,8 +173,10 @@ all_opt = {
 	"notls" : {
 		"getopt" : "t",
 		"longopt" : "notls",
-		"help" : "-t, --notls                    Disable TLS negotiation and force SSL3.0.\n" +
-	"                                        This should only be used for devices that do not support TLS1.0 and up.",
+		"help" : "-t, --notls                    "
+				"Disable TLS negotiation and force SSL3.0.\n"
+				"                                        "
+				"This should only be used for devices that do not support TLS1.0 and up.",
 		"required" : "0",
 		"shortdesc" : "Disable TLS negotiation",
 		"order" : 1 },
@@ -406,7 +408,6 @@ def add_dependency_options(options):
 			added_opt.extend([y for y in DEPENDENCY_OPT[x] if options.count(y) == 0])
 	return added_opt
 
-
 def version(command, release, build_date, copyright_notice):
 	print command, " ", release, " ", build_date
 	if len(copyright_notice) > 0:
@@ -426,8 +427,8 @@ def fail(error_code):
 		EC_WAITING_ON : "Failed: Timed out waiting to power ON",
 		EC_WAITING_OFF : "Failed: Timed out waiting to power OFF",
 		EC_STATUS : "Failed: Unable to obtain correct plug status or plug is not available",
-		EC_STATUS_HMC :
-			"Failed: Either unable to obtain correct plug status, partition is not available or incorrect HMC version used",
+		EC_STATUS_HMC : "Failed: Either unable to obtain correct plug status, "
+				"partition is not available or incorrect HMC version used",
 		EC_PASSWORD_MISSING : "Failed: You have to set login password",
 		EC_INVALID_PRIVILEGES : "Failed: The user does not have the correct privileges to do the requested action."
 	}[error_code] + "\n"
@@ -453,7 +454,8 @@ def metadata(avail_opt, options, docs):
 	sorted_list.sort(lambda x, y: cmp(x[1]["order"], y[1]["order"]))
 
 	print "<?xml version=\"1.0\" ?>"
-	print "<resource-agent name=\"" + os.path.basename(sys.argv[0]) + "\" shortdesc=\"" + docs["shortdesc"] + "\" >"
+	print "<resource-agent name=\"" + os.path.basename(sys.argv[0]) + \
+			"\" shortdesc=\"" + docs["shortdesc"] + "\" >"
 	if "symlink" in docs:
 		for (symlink, desc) in docs["symlink"]:
 			print "<symlink name=\"" + symlink + "\" shortdesc=\"" + desc + "\"/>"
@@ -641,7 +643,8 @@ def check_input(device_opt, opt):
 
 	if device_opt.count("ipport"):
 		if options.has_key("--ipport"):
-			all_opt["ipport"]["help"] = "-u, --ipport=[port]            TCP/UDP port to use (default "+ options["--ipport"] +")"
+			all_opt["ipport"]["help"] = "-u, --ipport=[port]            " + \
+					"TCP/UDP port to use (default " + options["--ipport"] +")"
 		elif options.has_key("--ssh"):
 			all_opt["ipport"]["default"] = 22
 			all_opt["ipport"]["help"] = "-u, --ipport=[port]            TCP/UDP port to use (default 22)"
@@ -666,7 +669,8 @@ def check_input(device_opt, opt):
 
 	## In special cases (show help, metadata or version) we don't need to check anything
 	#####
-	if options.has_key("--help") or options.has_key("--version") or (options.has_key("--action") and options["--action"].lower() == "metadata"):
+	if options.has_key("--help") or options.has_key("--version") or \
+			(options.has_key("--action") and options["--action"].lower() == "metadata"):
 		return options
 
 	options["--action"] = options["--action"].lower()
@@ -695,7 +699,8 @@ def check_input(device_opt, opt):
 		options["--action"] = "off"
 
 	## automatic detection and set of valid UUID from --plug
-	if (0 == options.has_key("--username")) and device_opt.count("login") and (device_opt.count("no_login") == 0):
+	if (0 == options.has_key("--username")) and \
+			device_opt.count("login") and (device_opt.count("no_login") == 0):
 		fail_usage("Failed: You have to set login name")
 
 	if device_opt.count("ipaddr") and 0 == options.has_key("--ip") and 0 == options.has_key("--managed"):
@@ -706,7 +711,8 @@ def check_input(device_opt, opt):
 			if 0 == (options.has_key("--password") or options.has_key("--password-script")):
 				fail_usage("Failed: You have to enter password or password script")
 		else:
-			if 0 == (options.has_key("--password") or options.has_key("--password-script") or options.has_key("--identity-file")):
+			if 0 == (options.has_key("--password") or \
+					options.has_key("--password-script") or options.has_key("--identity-file")):
 				fail_usage("Failed: You have to enter password, password script or identity file")
 
 	if 0 == options.has_key("--ssh") and 1 == options.has_key("--identity-file"):
@@ -745,7 +751,8 @@ def check_input(device_opt, opt):
 		else:
 			options["--ipport"] = 23
 
-	if options.has_key("--plug") and len(options["--plug"].split(",")) > 1 and options.has_key("--method") and options["--method"] == "cycle":
+	if options.has_key("--plug") and len(options["--plug"].split(",")) > 1 and \
+			options.has_key("--method") and options["--method"] == "cycle":
 		fail_usage("Failed: Cannot use --method cycle for more than 1 plug")
 
 	for opt in device_opt:
@@ -755,7 +762,9 @@ def check_input(device_opt, opt):
 			if options.has_key(long):
 				options[long] = options[long].upper()
 				if not options["--" + all_opt[opt]["longopt"]] in possible_values_upper:
-					fail_usage("Failed: You have to enter a valid choice for %s from the valid values: %s" % ("--" + all_opt[opt]["longopt"] , str(all_opt[opt]["choices"])))
+					fail_usage("Failed: You have to enter a valid choice " + \
+							"for %s from the valid values: %s" % \
+							("--" + all_opt[opt]["longopt"] , str(all_opt[opt]["choices"])))
 
 	return options
 
@@ -846,7 +855,8 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
 			## None as soon as all existing agent will support this operation
 			print "NOTICE: List option is not working on this device yet"
 			return
-		elif (options["--action"] == "list") or ((options["--action"] == "monitor") and 1 == options["device_opt"].count("port")):
+		elif (options["--action"] == "list") or \
+				((options["--action"] == "monitor") and 1 == options["device_opt"].count("port")):
 			outlets = get_outlet_list(tn, options)
 			## keys can be numbers (port numbers) or strings (names of VM)
 			for o in outlets.keys():
@@ -971,7 +981,8 @@ def fence_login(options, re_login_string = "(login\s*: )|(Login Name:  )|(userna
 			if options.has_key("--notls"):
 				gnutls_opts = "--priority \"NORMAL:-VERS-TLS1.2:-VERS-TLS1.1:-VERS-TLS1.0:+VERS-SSL3.0\""
 
-			command = '%s %s --insecure --crlf -p %s %s' % (SSL_PATH, gnutls_opts, options["--ipport"], options["--ip"])
+			command = '%s %s --insecure --crlf -p %s %s' % \
+					(SSL_PATH, gnutls_opts, options["--ipport"], options["--ip"])
 			try:
 				conn = fspawn(options, command)
 			except pexpect.ExceptionPexpect, ex:
@@ -979,15 +990,19 @@ def fence_login(options, re_login_string = "(login\s*: )|(Login Name:  )|(userna
 				syslog.syslog(syslog.LOG_ERR, str(ex))
 				sys.exit(EC_GENERIC_ERROR)
 		elif options.has_key("--ssh") and 0 == options.has_key("--identity-file"):
-			command = '%s %s %s@%s -p %s -o PubkeyAuthentication=no' % (SSH_PATH, force_ipvx, options["--username"], options["--ip"], options["--ipport"])
+			command = '%s %s %s@%s -p %s -o PubkeyAuthentication=no' % \
+					(SSH_PATH, force_ipvx, options["--username"], options["--ip"], options["--ipport"])
 			if options.has_key("--ssh-options"):
 				command += ' ' + options["--ssh-options"]
 
 			conn = fspawn(options, command)
 
 			if options.has_key("telnet_over_ssh"):
-				#This is for stupid ssh servers (like ALOM) which behave more like telnet (ignore name and display login prompt)
-				result = conn.log_expect(options, [ re_login, "Are you sure you want to continue connecting (yes/no)?" ], int(options["--login-timeout"]))
+				# This is for stupid ssh servers (like ALOM) which behave more like telnet
+				# (ignore name and display login prompt)
+				result = conn.log_expect(options, \
+						[ re_login, "Are you sure you want to continue connecting (yes/no)?" ],
+						int(options["--login-timeout"]))
 				if result == 1:
 					conn.sendline("yes") # Host identity confirm
 					conn.log_expect(options, re_login, int(options["--login-timeout"]))
@@ -995,7 +1010,9 @@ def fence_login(options, re_login_string = "(login\s*: )|(Login Name:  )|(userna
 				conn.sendline(options["--username"])
 				conn.log_expect(options, re_pass, int(options["--login-timeout"]))
 			else:
-				result = conn.log_expect(options, [ "ssword:", "Are you sure you want to continue connecting (yes/no)?" ], int(options["--login-timeout"]))
+				result = conn.log_expect(options, \
+						[ "ssword:", "Are you sure you want to continue connecting (yes/no)?" ],
+						int(options["--login-timeout"]))
 				if result == 1:
 					conn.sendline("yes")
 					conn.log_expect(options, "ssword:", int(options["--login-timeout"]))
@@ -1003,17 +1020,22 @@ def fence_login(options, re_login_string = "(login\s*: )|(Login Name:  )|(userna
 			conn.sendline(options["--password"])
 			conn.log_expect(options, options["--command-prompt"], int(options["--login-timeout"]))
 		elif options.has_key("--ssh") and options.has_key("--identity-file"):
-			command = '%s %s %s@%s -i %s -p %s' % (SSH_PATH, force_ipvx, options["--username"], options["--ip"], options["--identity-file"], options["--ipport"])
+			command = '%s %s %s@%s -i %s -p %s' % \
+					(SSH_PATH, force_ipvx, options["--username"], options["--ip"], \
+					options["--identity-file"], options["--ipport"])
 			if options.has_key("--ssh-options"):
 				command += ' ' + options["--ssh-options"]
 
 			conn = fspawn(options, command)
 
 			result = conn.log_expect(options, [ "Enter passphrase for key '" + options["--identity-file"] + "':", \
-				"Are you sure you want to continue connecting (yes/no)?" ] + options["--command-prompt"], int(options["--login-timeout"]))
+					"Are you sure you want to continue connecting (yes/no)?" ] + \
+					options["--command-prompt"], int(options["--login-timeout"]))
 			if result == 1:
 				conn.sendline("yes")
-				result = conn.log_expect(options, [ "Enter passphrase for key '"+options["--identity-file"]+"':"] + options["--command-prompt"], int(options["--login-timeout"]))
+				result = conn.log_expect(options,
+					[ "Enter passphrase for key '" + options["--identity-file"]+"':"] + \
+					options["--command-prompt"], int(options["--login-timeout"]))
 			if result == 0:
 				if options.has_key("--password"):
 					conn.sendline(options["--password"])
@@ -1039,7 +1061,8 @@ def fence_login(options, re_login_string = "(login\s*: )|(Login Name:  )|(userna
 
 			try:
 				conn.send_eol(options["--password"])
-				valid_password = conn.log_expect(options, [ re_login ] + options["--command-prompt"], int(options["--shell-timeout"]))
+				valid_password = conn.log_expect(options, [ re_login ] + \
+						options["--command-prompt"], int(options["--shell-timeout"]))
 				if valid_password == 0:
 					## password is invalid or we have to change EOL separator
 					options["eol"] = "\r"
diff --git a/fence/agents/lib/fencing_snmp.py.py b/fence/agents/lib/fencing_snmp.py.py
index 0112494..3faa295 100644
--- a/fence/agents/lib/fencing_snmp.py.py
+++ b/fence/agents/lib/fencing_snmp.py.py
@@ -29,10 +29,13 @@ class FencingSnmp:
 		return ''.join(map(lambda x:x==r"'" and "'\\''" or x, string))
 
 	def complete_missed_params(self):
-		mapping = [
-			[['snmp-priv-passwd','password','!snmp-sec-level'],'self.options["--snmp-sec-level"]="authPriv"'],
-			[['!snmp-version','community','!username','!snmp-priv-passwd','!password'],'self.options["--snmp-version"]="2c"']
-			]
+		mapping = [[
+					['snmp-priv-passwd','password','!snmp-sec-level'],
+					'self.options["--snmp-sec-level"]="authPriv"'
+				],[
+					['!snmp-version','community','!username','!snmp-priv-passwd','!password'],
+					'self.options["--snmp-version"]="2c"'
+				]]
 
 		for val in mapping:
 			e = val[0]
@@ -88,7 +91,10 @@ class FencingSnmp:
 		try:
 			self.log_command(command)
 
-			(res_output, res_code) = pexpect.run(command, int(self.options["--shell-timeout"]) + int(self.options["--login-timeout"]) + additional_timemout, True)
+			(res_output, res_code) = pexpect.run(command,
+					int(self.options["--shell-timeout"]) +
+					int(self.options["--login-timeout"]) +
+					additional_timemout, True)
 
 			if (res_code==None):
 				fail(EC_TIMED_OUT)
@@ -119,7 +125,8 @@ class FencingSnmp:
 				type_of_value = item[1]
 				break
 
-		cmd = "%s '%s' %s '%s'"% (self.prepare_cmd("snmpset"), self.quote_for_run(oid), type_of_value, self.quote_for_run(str(value)))
+		cmd = "%s '%s' %s '%s'" % (self.prepare_cmd("snmpset"),
+				self.quote_for_run(oid), type_of_value, self.quote_for_run(str(value)))
 
 		self.run_command(cmd, additional_timemout)
 
diff --git a/fence/agents/lpar/fence_lpar.py b/fence/agents/lpar/fence_lpar.py
index c4237f2..438acae 100644
--- a/fence/agents/lpar/fence_lpar.py
+++ b/fence/agents/lpar/fence_lpar.py
@@ -27,11 +27,13 @@ def get_power_status(conn, options):
 		conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 
 		try:
-			status = re.compile("^" + options["--plug"] + ",(.*?),.*$", re.IGNORECASE | re.MULTILINE).search(conn.before).group(1)
+			status = re.compile("^" + options["--plug"] + ",(.*?),.*$",
+					re.IGNORECASE | re.MULTILINE).search(conn.before).group(1)
 		except AttributeError:
 			fail(EC_STATUS_HMC)
 	elif options["--hmc-version"] == "4":
-		conn.send("lssyscfg -r lpar -m "+ options["--managed"] +" --filter 'lpar_names=" + options["--plug"] + "'\n")
+		conn.send("lssyscfg -r lpar -m "+ options["--managed"] +
+				" --filter 'lpar_names=" + options["--plug"] + "'\n")
 		conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 
 		try:
diff --git a/fence/agents/ovh/fence_ovh.py b/fence/agents/ovh/fence_ovh.py
index 4d2d9cb..647343c 100644
--- a/fence/agents/ovh/fence_ovh.py
+++ b/fence/agents/ovh/fence_ovh.py
@@ -40,7 +40,8 @@ def netboot_reboot(options, mode):
 	conn.service.dedicatedNetbootModifyById(options["session"], options["--plug"], mode, '', options["--email"])
 
 	# dedicatedHardRebootDo initiates a hard reboot on the given node
-	conn.service.dedicatedHardRebootDo(options["session"], options["--plug"], 'Fencing initiated by cluster', '', 'en')
+	conn.service.dedicatedHardRebootDo(options["session"],
+			options["--plug"], 'Fencing initiated by cluster', '', 'en')
 
 	conn.logout(options["session"])
 
@@ -124,10 +125,14 @@ Poweroff is simulated with a reboot into rescue-pro mode."
 	reboot_t = reboot_time(options)
 
 	if options.has_key("--verbose"):
-		options["debug_fh"].write("reboot_start_end.start: "+ reboot_t.start.strftime('%Y-%m-%d %H:%M:%S')+"\n")
-		options["debug_fh"].write("before_netboot_reboot: " + before_netboot_reboot.strftime('%Y-%m-%d %H:%M:%S')+"\n")
-		options["debug_fh"].write("reboot_start_end.end: "  + reboot_t.end.strftime('%Y-%m-%d %H:%M:%S')+"\n")
-		options["debug_fh"].write("after_netboot_reboot: "  + after_netboot_reboot.strftime('%Y-%m-%d %H:%M:%S')+"\n")
+		options["debug_fh"].write("reboot_start_end.start: " +
+				reboot_t.start.strftime('%Y-%m-%d %H:%M:%S')+"\n")
+		options["debug_fh"].write("before_netboot_reboot: " +
+				before_netboot_reboot.strftime('%Y-%m-%d %H:%M:%S')+"\n")
+		options["debug_fh"].write("reboot_start_end.end: " +
+				reboot_t.end.strftime('%Y-%m-%d %H:%M:%S')+"\n")
+		options["debug_fh"].write("after_netboot_reboot: " +
+				after_netboot_reboot.strftime('%Y-%m-%d %H:%M:%S')+"\n")
 
 	if reboot_t.start < after_netboot_reboot < reboot_t.end:
 		result = 0
diff --git a/fence/agents/sanbox2/fence_sanbox2.py b/fence/agents/sanbox2/fence_sanbox2.py
index 86b646b..e0c0647 100644
--- a/fence/agents/sanbox2/fence_sanbox2.py
+++ b/fence/agents/sanbox2/fence_sanbox2.py
@@ -36,7 +36,8 @@ def get_power_status(conn, options):
 			pass
 		fail(EC_TIMED_OUT)
 
-	status = re.compile(".*AdminState\s+(online|offline)\s+", re.IGNORECASE | re.MULTILINE).search(conn.before).group(1)
+	status = re.compile(".*AdminState\s+(online|offline)\s+",
+			re.IGNORECASE | re.MULTILINE).search(conn.before).group(1)
 
 	try:
 		return status_trans[status.lower().strip()]
diff --git a/fence/agents/virsh/fence_virsh.py b/fence/agents/virsh/fence_virsh.py
index 0ebf668..29d3e58 100644
--- a/fence/agents/virsh/fence_virsh.py
+++ b/fence/agents/virsh/fence_virsh.py
@@ -40,7 +40,8 @@ def get_outlets_status(conn, options):
 			if ((fa_status==0) and (domain.group(1).lower()=="id") and (domain.group(2).lower()=="name")):
 				fa_status = 1
 			elif (fa_status==1):
-				result[domain.group(2)] = ("", (domain.group(3).lower() in ["running", "blocked", "idle", "no state", "paused"] and "on" or "off"))
+				result[domain.group(2)] = ("",
+						(domain.group(3).lower() in ["running", "blocked", "idle", "no state", "paused"] and "on" or "off"))
 	return result
 
 def get_power_status(conn, options):
@@ -58,7 +59,8 @@ def get_power_status(conn, options):
 
 def set_power_status(conn, options):
 	prefix = SUDO_PATH + " " if options.has_key("--use-sudo") else ""
-	conn.sendline(prefix + "virsh %s "%(options["--action"] == "on" and "start" or "destroy") + get_name_or_uuid(options))
+	conn.sendline(prefix + "virsh %s " %
+			(options["--action"] == "on" and "start" or "destroy") + get_name_or_uuid(options))
 
 	conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 	time.sleep(int(options["--power-wait"]))
diff --git a/fence/agents/vmware/fence_vmware.py b/fence/agents/vmware/fence_vmware.py
index c6209e8..8b76103 100644
--- a/fence/agents/vmware/fence_vmware.py
+++ b/fence/agents/vmware/fence_vmware.py
@@ -149,7 +149,8 @@ def vmware_run_command(options, add_login_params, additional_params, additional_
 	try:
 		vmware_log(options, command)
 
-		(res_output, res_code) = pexpect.run(command, int(options["--shell-timeout"])+int(options["--login-timeout"])+additional_timeout, True)
+		(res_output, res_code) = pexpect.run(command,
+				int(options["--shell-timeout"]) + int(options["--login-timeout"]) + additional_timeout, True)
 
 		if (res_code==None):
 			fail(EC_TIMED_OUT)
@@ -170,7 +171,8 @@ def vmware_get_outlets_vi(conn, options, add_vm_name):
 	outlets = {}
 
 	if (add_vm_name):
-		all_machines = vmware_run_command(options, True, ("--operation status --vmname '%s'"% (quote_for_run(options["--plug"]))), 0)
+		all_machines = vmware_run_command(options, True,
+				("--operation status --vmname '%s'"% (quote_for_run(options["--plug"]))), 0)
 	else:
 		all_machines = vmware_run_command(options, True, "--operation list", int(options["--power-timeout"]))
 
@@ -232,9 +234,11 @@ def get_power_status(conn, options):
 
 def set_power_status(conn, options):
 	if (vmware_internal_type==VMWARE_TYPE_ESX):
-		additional_params = "--operation %s --vmname '%s'"% ((options["--action"]=="on" and "on" or "off"), quote_for_run(options["--plug"]))
+		additional_params = "--operation %s --vmname '%s'" % \
+				((options["--action"]=="on" and "on" or "off"), quote_for_run(options["--plug"]))
 	elif ((vmware_internal_type==VMWARE_TYPE_SERVER1) or (vmware_internal_type==VMWARE_TYPE_SERVER2)):
-		additional_params = "%s '%s'"% ((options["--action"]=="on" and "start" or "stop"), quote_for_run(options["--plug"]))
+		additional_params = "%s '%s'" % \
+				((options["--action"]=="on" and "start" or "stop"), quote_for_run(options["--plug"]))
 		if (options["--action"]=="off"):
 			additional_params += " hard"
 
@@ -323,7 +327,8 @@ This agent supports only vmrun from version 2.0.0 (VIX API 1.6.0)."
 	# Test user vmrun command version
 	if ((vmware_internal_type==VMWARE_TYPE_SERVER1) or (vmware_internal_type==VMWARE_TYPE_SERVER2)):
 		if (not (vmware_is_supported_vmrun_version(options))):
-			fail_usage("Unsupported version of vmrun command! You must use at least version %d!"%(VMRUN_MINIMUM_REQUIRED_VERSION))
+			fail_usage("Unsupported version of vmrun command! You must use@least version %d!" %
+					(VMRUN_MINIMUM_REQUIRED_VERSION))
 
 	# Operate the fencing device
 	result = fence_action(None, options, set_power_status, get_power_status, get_outlets_status)
diff --git a/fence/agents/vmware_soap/fence_vmware_soap.py b/fence/agents/vmware_soap/fence_vmware_soap.py
index 8110c9e..6fa3cd6 100644
--- a/fence/agents/vmware_soap/fence_vmware_soap.py
+++ b/fence/agents/vmware_soap/fence_vmware_soap.py
@@ -73,7 +73,8 @@ def get_power_status(conn, options):
 	mo_PropertyCollector = Property(options["ServiceContent"].propertyCollector.value)
 	mo_PropertyCollector._type = 'PropertyCollector'
 
-	ContainerView = conn.service.CreateContainerView(mo_ViewManager, recursive = 1, container = mo_RootFolder, type = ['VirtualMachine'])
+	ContainerView = conn.service.CreateContainerView(mo_ViewManager, recursive = 1,
+			container = mo_RootFolder, type = ['VirtualMachine'])
 	mo_ContainerView = Property(ContainerView.value)
 	mo_ContainerView._type = "ContainerView"
 
diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py
index 9b7aa39..1cb3356 100644
--- a/fence/agents/wti/fence_wti.py
+++ b/fence/agents/wti/fence_wti.py
@@ -58,7 +58,8 @@ def get_plug_status(conn, options):
 			plug_line = [x.strip().lower() for x in line.split("|")]
 			if len(plug_line) < len(plug_header):
 				plug_section = -1
-			if ["list", "monitor"].count(options["--action"]) == 0 and options["--plug"].lower() == plug_line[plug_index]:
+			if ["list", "monitor"].count(options["--action"]) == 0 and \
+					options["--plug"].lower() == plug_line[plug_index]:
 				return plug_line[status_index]
 			else:
 				## We already believe that first column contains plug number
@@ -94,11 +95,14 @@ def get_plug_group_status(conn, options):
 		line = lines[line_index]
 		if (line.find("|") >= 0 and line.lstrip().startswith("GROUP NAME") == False):
 			plug_line = [x.strip().lower() for x in line.split("|")]
-			if ["list", "monitor"].count(options["--action"]) == 0 and options["--plug"].lower() == plug_line[name_index]:
+			if ["list", "monitor"].count(options["--action"]) == 0 and \
+					options["--plug"].lower() == plug_line[name_index]:
 				plug_status = []
 				while line_index < len(lines) and line_index >= 0:
 					plug_line = [x.strip().lower() for x in lines[line_index].split("|")]
-					if len(plug_line) >= max(name_index, status_index) and len(plug_line[plug_index]) > 0 and (len(plug_line[name_index]) == 0 or options["--plug"].lower() == plug_line[name_index]):
+					if len(plug_line) >= max(name_index, status_index) and \
+							len(plug_line[plug_index]) > 0 and \
+							(len(plug_line[name_index]) == 0 or options["--plug"].lower() == plug_line[name_index]):
 						## Firmware 1.43 does not have a valid value of plug on first line as only name is defined on that line
 						if not "---" in plug_line[status_index]:
 							plug_status.append(plug_line[status_index])
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Cluster-devel] [PATCH 05/15] [cleanup] Remove unused dependencies
  2014-04-02 11:52 [Cluster-devel] [PATCH 01/15] [cleanup] Add missing spaces and fix tab/spaces indentation Marek 'marx' Grac
                   ` (2 preceding siblings ...)
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 04/15] [cleanup] Split lines that were too long Marek 'marx' Grac
@ 2014-04-02 11:52 ` Marek 'marx' Grac
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 06/15] [cleanup] Remove problems with redefining variables/functions Marek 'marx' Grac
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Marek 'marx' Grac @ 2014-04-02 11:52 UTC (permalink / raw)
  To: cluster-devel.redhat.com

---
 fence/agents/alom/fence_alom.py               | 2 +-
 fence/agents/amt/fence_amt.py                 | 2 +-
 fence/agents/apc/fence_apc.py                 | 2 +-
 fence/agents/bladecenter/fence_bladecenter.py | 2 +-
 fence/agents/brocade/fence_brocade.py         | 2 +-
 fence/agents/drac/fence_drac.py               | 2 +-
 fence/agents/drac5/fence_drac5.py             | 2 +-
 fence/agents/dummy/fence_dummy.py             | 2 +-
 fence/agents/hds_cb/fence_hds_cb.py           | 2 +-
 fence/agents/hpblade/fence_hpblade.py         | 2 +-
 fence/agents/ilo_mp/fence_ilo_mp.py           | 2 +-
 fence/agents/ipmilan/fence_ipmilan.py         | 2 +-
 fence/agents/lpar/fence_lpar.py               | 2 +-
 fence/agents/netio/fence_netio.py             | 2 +-
 fence/agents/rsa/fence_rsa.py                 | 2 +-
 fence/agents/rsb/fence_rsb.py                 | 2 +-
 fence/agents/virsh/fence_virsh.py             | 2 +-
 fence/agents/vmware/fence_vmware.py           | 2 +-
 fence/agents/vmware_soap/fence_vmware_soap.py | 2 +-
 fence/agents/wti/fence_wti.py                 | 2 +-
 20 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/fence/agents/alom/fence_alom.py b/fence/agents/alom/fence_alom.py
index ae484a4..2844904 100644
--- a/fence/agents/alom/fence_alom.py
+++ b/fence/agents/alom/fence_alom.py
@@ -5,7 +5,7 @@
 # Sun(tm) Advanced Lights Out Manager CMT v1.6.1
 # as found on SUN T2000 Niagara
 
-import sys, re, pexpect, time, exceptions
+import sys, re, time
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
diff --git a/fence/agents/amt/fence_amt.py b/fence/agents/amt/fence_amt.py
index 51022ee..1286bd9 100644
--- a/fence/agents/amt/fence_amt.py
+++ b/fence/agents/amt/fence_amt.py
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 
-import sys, subprocess, re, os, stat
+import sys, subprocess, re
 import atexit
 from pipes import quote
 sys.path.append("@FENCEAGENTSLIBDIR@")
diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index b97bbff..d976be6 100644
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -14,7 +14,7 @@
 ##        cipher (des/blowfish) have to be defined
 #####
 
-import sys, re, pexpect, exceptions
+import sys, re
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
diff --git a/fence/agents/bladecenter/fence_bladecenter.py b/fence/agents/bladecenter/fence_bladecenter.py
index d3a0301..e94fd7d 100644
--- a/fence/agents/bladecenter/fence_bladecenter.py
+++ b/fence/agents/bladecenter/fence_bladecenter.py
@@ -12,7 +12,7 @@
 ##
 #####
 
-import sys, re, pexpect, exceptions
+import sys, re
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
diff --git a/fence/agents/brocade/fence_brocade.py b/fence/agents/brocade/fence_brocade.py
index 018f3c0..9e37e49 100644
--- a/fence/agents/brocade/fence_brocade.py
+++ b/fence/agents/brocade/fence_brocade.py
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 
-import sys, re, pexpect, exceptions
+import sys, re
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
diff --git a/fence/agents/drac/fence_drac.py b/fence/agents/drac/fence_drac.py
index 90314f4..ba08ee7 100644
--- a/fence/agents/drac/fence_drac.py
+++ b/fence/agents/drac/fence_drac.py
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 
-import sys, re, pexpect, exceptions
+import sys, re
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
diff --git a/fence/agents/drac5/fence_drac5.py b/fence/agents/drac5/fence_drac5.py
index 036f294..b95b1c7 100644
--- a/fence/agents/drac5/fence_drac5.py
+++ b/fence/agents/drac5/fence_drac5.py
@@ -12,7 +12,7 @@
 ## @note: drac_version was removed
 #####
 
-import sys, re, pexpect, exceptions, time
+import sys, re, time
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
diff --git a/fence/agents/dummy/fence_dummy.py b/fence/agents/dummy/fence_dummy.py
index cc136d4..fb79b1a 100644
--- a/fence/agents/dummy/fence_dummy.py
+++ b/fence/agents/dummy/fence_dummy.py
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 
-import sys, re, pexpect, exceptions, random
+import sys, random
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
diff --git a/fence/agents/hds_cb/fence_hds_cb.py b/fence/agents/hds_cb/fence_hds_cb.py
index d8046b1..78754fc 100755
--- a/fence/agents/hds_cb/fence_hds_cb.py
+++ b/fence/agents/hds_cb/fence_hds_cb.py
@@ -10,7 +10,7 @@
 ##
 #####
 
-import sys, re, pexpect, exceptions
+import sys, re
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
diff --git a/fence/agents/hpblade/fence_hpblade.py b/fence/agents/hpblade/fence_hpblade.py
index e2de148..84e0b0b 100644
--- a/fence/agents/hpblade/fence_hpblade.py
+++ b/fence/agents/hpblade/fence_hpblade.py
@@ -6,7 +6,7 @@
 ##  * BladeSystem c7000 Enclosure
 #####
 
-import sys, re, pexpect, exceptions
+import sys, re
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
diff --git a/fence/agents/ilo_mp/fence_ilo_mp.py b/fence/agents/ilo_mp/fence_ilo_mp.py
index 5bb234b..c76c281 100644
--- a/fence/agents/ilo_mp/fence_ilo_mp.py
+++ b/fence/agents/ilo_mp/fence_ilo_mp.py
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 
-import sys, re, pexpect, exceptions
+import sys, re
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
diff --git a/fence/agents/ipmilan/fence_ipmilan.py b/fence/agents/ipmilan/fence_ipmilan.py
index 7b37194..7254c73 100644
--- a/fence/agents/ipmilan/fence_ipmilan.py
+++ b/fence/agents/ipmilan/fence_ipmilan.py
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 
-import sys, shlex, stat, subprocess, re, os
+import sys, shlex, subprocess, re, os
 import atexit
 from pipes import quote
 sys.path.append("@FENCEAGENTSLIBDIR@")
diff --git a/fence/agents/lpar/fence_lpar.py b/fence/agents/lpar/fence_lpar.py
index 438acae..05e9b28 100644
--- a/fence/agents/lpar/fence_lpar.py
+++ b/fence/agents/lpar/fence_lpar.py
@@ -10,7 +10,7 @@
 ##
 #####
 
-import sys, re, pexpect, exceptions
+import sys, re
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
diff --git a/fence/agents/netio/fence_netio.py b/fence/agents/netio/fence_netio.py
index 5902e2e..e483470 100755
--- a/fence/agents/netio/fence_netio.py
+++ b/fence/agents/netio/fence_netio.py
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 
-import sys, re, pexpect, exceptions
+import sys, re, pexpect
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
diff --git a/fence/agents/rsa/fence_rsa.py b/fence/agents/rsa/fence_rsa.py
index 992c5e6..4e855a2 100644
--- a/fence/agents/rsa/fence_rsa.py
+++ b/fence/agents/rsa/fence_rsa.py
@@ -7,7 +7,7 @@
 ##
 #####
 
-import sys, re, pexpect, exceptions
+import sys, re
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
diff --git a/fence/agents/rsb/fence_rsb.py b/fence/agents/rsb/fence_rsb.py
index 6c5e119..89fb304 100755
--- a/fence/agents/rsb/fence_rsb.py
+++ b/fence/agents/rsb/fence_rsb.py
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 
-import sys, re, pexpect, exceptions
+import sys, re
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
diff --git a/fence/agents/virsh/fence_virsh.py b/fence/agents/virsh/fence_virsh.py
index 29d3e58..170c089 100644
--- a/fence/agents/virsh/fence_virsh.py
+++ b/fence/agents/virsh/fence_virsh.py
@@ -5,7 +5,7 @@
 # Virsh 0.3.3 on RHEL 5.2 with xen-3.0.3-51
 #
 
-import sys, re, pexpect, exceptions
+import sys, re
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
diff --git a/fence/agents/vmware/fence_vmware.py b/fence/agents/vmware/fence_vmware.py
index 8b76103..f278698 100644
--- a/fence/agents/vmware/fence_vmware.py
+++ b/fence/agents/vmware/fence_vmware.py
@@ -22,7 +22,7 @@
 #	VMware vCenter 4.0.0
 #
 
-import sys, re, pexpect, exceptions
+import sys, re, pexpect
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
diff --git a/fence/agents/vmware_soap/fence_vmware_soap.py b/fence/agents/vmware_soap/fence_vmware_soap.py
index 6fa3cd6..b55b56c 100644
--- a/fence/agents/vmware_soap/fence_vmware_soap.py
+++ b/fence/agents/vmware_soap/fence_vmware_soap.py
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 
-import sys, exceptions, time
+import sys, time
 import shutil, tempfile, suds
 import logging
 import atexit
diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py
index 1cb3356..bcb287b 100644
--- a/fence/agents/wti/fence_wti.py
+++ b/fence/agents/wti/fence_wti.py
@@ -11,7 +11,7 @@
 ##  WTI IPS-800-CE     v1.40h		(no username) ('list' tested)
 #####
 
-import sys, re, pexpect, exceptions
+import sys, re, pexpect
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Cluster-devel] [PATCH 06/15] [cleanup] Remove problems with redefining variables/functions
  2014-04-02 11:52 [Cluster-devel] [PATCH 01/15] [cleanup] Add missing spaces and fix tab/spaces indentation Marek 'marx' Grac
                   ` (3 preceding siblings ...)
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 05/15] [cleanup] Remove unused dependencies Marek 'marx' Grac
@ 2014-04-02 11:52 ` Marek 'marx' Grac
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 07/15] [cleanup] Only symbols that should be used are exported from fencing library Marek 'marx' Grac
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Marek 'marx' Grac @ 2014-04-02 11:52 UTC (permalink / raw)
  To: cluster-devel.redhat.com

---
 fence/agents/eps/fence_eps.py       |  4 ++--
 fence/agents/ifmib/fence_ifmib.py   |  4 ++--
 fence/agents/ipdu/fence_ipdu.py     |  2 ++
 fence/agents/lib/fencing.py.py      | 11 +++--------
 fence/agents/vmware/fence_vmware.py |  4 ++--
 5 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/fence/agents/eps/fence_eps.py b/fence/agents/eps/fence_eps.py
index bd43e58..42e2be7 100644
--- a/fence/agents/eps/fence_eps.py
+++ b/fence/agents/eps/fence_eps.py
@@ -16,9 +16,9 @@ BUILD_DATE=""
 #END_VERSION_GENERATION
 
 # Log actions and results from EPS device
-def eps_log(options, str):
+def eps_log(options, text):
 	if options["log"] >= LOG_MODE_VERBOSE:
-		options["debug_fh"].write(str)
+		options["debug_fh"].write(text)
 
 # Run command on EPS device.
 # @param options Device options
diff --git a/fence/agents/ifmib/fence_ifmib.py b/fence/agents/ifmib/fence_ifmib.py
index e7d1fa5..1273b0e 100644
--- a/fence/agents/ifmib/fence_ifmib.py
+++ b/fence/agents/ifmib/fence_ifmib.py
@@ -85,10 +85,10 @@ def get_outlets_status(conn, options):
 	res_aliases = array_to_dict(conn.walk(ALIASES_OID, 30))
 
 	for x in res_fc:
-		port_num = x[0].split('.')[-1]
+		port_number = x[0].split('.')[-1]
 
 		port_name = x[1].strip('"')
-		port_alias = (res_aliases.has_key(port_num) and res_aliases[port_num].strip('"') or "")
+		port_alias = (res_aliases.has_key(port_number) and res_aliases[port_number].strip('"') or "")
 		port_status = ""
 		result[port_name] = (port_alias, port_status)
 
diff --git a/fence/agents/ipdu/fence_ipdu.py b/fence/agents/ipdu/fence_ipdu.py
index b90a333..c1fc368 100644
--- a/fence/agents/ipdu/fence_ipdu.py
+++ b/fence/agents/ipdu/fence_ipdu.py
@@ -126,6 +126,8 @@ def get_outlets_status(conn, options):
 
 # Main agent method
 def main():
+	global device
+
 	device_opt = [ "ipaddr", "login", "passwd", "no_login", "no_password", \
 		       "port", "snmp_version", "community" ]
 
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index a713dc8..6aab45b 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -408,11 +408,6 @@ def add_dependency_options(options):
 			added_opt.extend([y for y in DEPENDENCY_OPT[x] if options.count(y) == 0])
 	return added_opt
 
-def version(command, release, build_date, copyright_notice):
-	print command, " ", release, " ", build_date
-	if len(copyright_notice) > 0:
-		print copyright_notice
-
 def fail_usage(message = ""):
 	if len(message) > 0:
 		sys.stderr.write(message+"\n")
@@ -757,10 +752,10 @@ def check_input(device_opt, opt):
 
 	for opt in device_opt:
 		if all_opt[opt].has_key("choices"):
-			long = "--" + all_opt[opt]["longopt"]
+			longopt = "--" + all_opt[opt]["longopt"]
 			possible_values_upper = map (lambda y : y.upper(), all_opt[opt]["choices"])
-			if options.has_key(long):
-				options[long] = options[long].upper()
+			if options.has_key(longopt):
+				options[longopt] = options[longopt].upper()
 				if not options["--" + all_opt[opt]["longopt"]] in possible_values_upper:
 					fail_usage("Failed: You have to enter a valid choice " + \
 							"for %s from the valid values: %s" % \
diff --git a/fence/agents/vmware/fence_vmware.py b/fence/agents/vmware/fence_vmware.py
index f278698..f0f6023 100644
--- a/fence/agents/vmware/fence_vmware.py
+++ b/fence/agents/vmware/fence_vmware.py
@@ -94,10 +94,10 @@ def dsv_split(dsv_str):
 
 # Quote string for proper existence in quoted string used for pexpect.run function
 # Ex. test'this will return test'\''this. So pexpect run will really pass ' to argument
-def quote_for_run(str):
+def quote_for_run(text):
 	dstr = ''
 
-	for c in str:
+	for c in text:
 		if c == r"'":
 			dstr += "'\\''"
 		else:
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Cluster-devel] [PATCH 07/15] [cleanup] Only symbols that should be used are exported from fencing library
  2014-04-02 11:52 [Cluster-devel] [PATCH 01/15] [cleanup] Add missing spaces and fix tab/spaces indentation Marek 'marx' Grac
                   ` (4 preceding siblings ...)
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 06/15] [cleanup] Remove problems with redefining variables/functions Marek 'marx' Grac
@ 2014-04-02 11:52 ` Marek 'marx' Grac
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 08/15] [cleanup] Mark raw strings with r"" Marek 'marx' Grac
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Marek 'marx' Grac @ 2014-04-02 11:52 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Previously, all symbols were exported what ends with redefining some symbols. Currently, the
wildcard (from fencing import *) imports only those that should be used. Rest of them make sense
for some fence agents (e.g. TELNET_PATH if we are not able to use regular fence_login) but there
are some symbols which have to be used before but they are not needed now. This will be solved later.
---
 fence/agents/amt/fence_amt.py                 | 1 +
 fence/agents/apc/fence_apc.py                 | 1 +
 fence/agents/bladecenter/fence_bladecenter.py | 1 +
 fence/agents/brocade/fence_brocade.py         | 1 +
 fence/agents/cisco_mds/fence_cisco_mds.py     | 1 +
 fence/agents/cisco_ucs/fence_cisco_ucs.py     | 2 ++
 fence/agents/drac5/fence_drac5.py             | 1 +
 fence/agents/dummy/fence_dummy.py             | 2 ++
 fence/agents/eps/fence_eps.py                 | 1 +
 fence/agents/hpblade/fence_hpblade.py         | 1 +
 fence/agents/ifmib/fence_ifmib.py             | 1 +
 fence/agents/ilo/fence_ilo.py                 | 1 +
 fence/agents/ipmilan/fence_ipmilan.py         | 1 +
 fence/agents/ldom/fence_ldom.py               | 1 +
 fence/agents/lib/fencing.py.py                | 3 +++
 fence/agents/lib/fencing_snmp.py.py           | 1 +
 fence/agents/lpar/fence_lpar.py               | 1 +
 fence/agents/netio/fence_netio.py             | 1 +
 fence/agents/ovh/fence_ovh.py                 | 1 +
 fence/agents/rhevm/fence_rhevm.py             | 1 +
 fence/agents/sanbox2/fence_sanbox2.py         | 1 +
 fence/agents/virsh/fence_virsh.py             | 2 ++
 fence/agents/vmware/fence_vmware.py           | 1 +
 fence/agents/vmware_soap/fence_vmware_soap.py | 1 +
 fence/agents/wti/fence_wti.py                 | 2 ++
 25 files changed, 31 insertions(+)

diff --git a/fence/agents/amt/fence_amt.py b/fence/agents/amt/fence_amt.py
index 1286bd9..346677e 100644
--- a/fence/agents/amt/fence_amt.py
+++ b/fence/agents/amt/fence_amt.py
@@ -5,6 +5,7 @@ import atexit
 from pipes import quote
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
+from fencing import fail_usage, is_executable, SUDO_PATH, LOG_MODE_VERBOSE
 
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION="Fence agent for Intel AMT"
diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index d976be6..76b544b 100644
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -18,6 +18,7 @@ import sys, re
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
+from fencing import fail, fail_usage, EC_STATUS
 
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION="New APC Agent - test release on steroids"
diff --git a/fence/agents/bladecenter/fence_bladecenter.py b/fence/agents/bladecenter/fence_bladecenter.py
index e94fd7d..34a8975 100644
--- a/fence/agents/bladecenter/fence_bladecenter.py
+++ b/fence/agents/bladecenter/fence_bladecenter.py
@@ -16,6 +16,7 @@ import sys, re
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
+from fencing import fail, EC_STATUS, EC_GENERIC_ERROR
 
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION="New Bladecenter Agent - test release on steroids"
diff --git a/fence/agents/brocade/fence_brocade.py b/fence/agents/brocade/fence_brocade.py
index 9e37e49..2deab5b 100644
--- a/fence/agents/brocade/fence_brocade.py
+++ b/fence/agents/brocade/fence_brocade.py
@@ -4,6 +4,7 @@ import sys, re
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
+from fencing import fail, EC_STATUS
 
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION="New Brocade Agent - test release on steroids"
diff --git a/fence/agents/cisco_mds/fence_cisco_mds.py b/fence/agents/cisco_mds/fence_cisco_mds.py
index f6eed64..6af1e99 100644
--- a/fence/agents/cisco_mds/fence_cisco_mds.py
+++ b/fence/agents/cisco_mds/fence_cisco_mds.py
@@ -10,6 +10,7 @@ import sys, re
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
+from fencing import fail_usage
 from fencing_snmp import *
 
 #BEGIN_VERSION_GENERATION
diff --git a/fence/agents/cisco_ucs/fence_cisco_ucs.py b/fence/agents/cisco_ucs/fence_cisco_ucs.py
index 388eda9..81a911e 100644
--- a/fence/agents/cisco_ucs/fence_cisco_ucs.py
+++ b/fence/agents/cisco_ucs/fence_cisco_ucs.py
@@ -2,9 +2,11 @@
 
 import sys, re
 import pycurl, StringIO
+import time
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
+from fencing import fail, EC_STATUS, EC_LOGIN_DENIED, LOG_MODE_VERBOSE
 
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION="New Cisco UCS Agent - test release on steroids"
diff --git a/fence/agents/drac5/fence_drac5.py b/fence/agents/drac5/fence_drac5.py
index b95b1c7..642dcda 100644
--- a/fence/agents/drac5/fence_drac5.py
+++ b/fence/agents/drac5/fence_drac5.py
@@ -16,6 +16,7 @@ import sys, re, time
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
+from fencing import fail_usage
 
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION="New Drac5 Agent - test release on steroids"
diff --git a/fence/agents/dummy/fence_dummy.py b/fence/agents/dummy/fence_dummy.py
index fb79b1a..dc65bee 100644
--- a/fence/agents/dummy/fence_dummy.py
+++ b/fence/agents/dummy/fence_dummy.py
@@ -1,9 +1,11 @@
 #!/usr/bin/python
 
 import sys, random
+import time
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
+from fencing import fail_usage
 
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION="New Dummy Agent - test release on steroids"
diff --git a/fence/agents/eps/fence_eps.py b/fence/agents/eps/fence_eps.py
index 42e2be7..3c4be8d 100644
--- a/fence/agents/eps/fence_eps.py
+++ b/fence/agents/eps/fence_eps.py
@@ -8,6 +8,7 @@ import httplib, base64, string, socket
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
+from fencing import fail, fail_usage, EC_LOGIN_DENIED, EC_TIMED_OUT, LOG_MODE_VERBOSE
 
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION="ePowerSwitch 8M+ (eps)"
diff --git a/fence/agents/hpblade/fence_hpblade.py b/fence/agents/hpblade/fence_hpblade.py
index 84e0b0b..44032d3 100644
--- a/fence/agents/hpblade/fence_hpblade.py
+++ b/fence/agents/hpblade/fence_hpblade.py
@@ -10,6 +10,7 @@ import sys, re
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
+from fencing import fail, EC_STATUS
 
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION="New Bladecenter Agent - test release on steroids"
diff --git a/fence/agents/ifmib/fence_ifmib.py b/fence/agents/ifmib/fence_ifmib.py
index 1273b0e..3ecc85d 100644
--- a/fence/agents/ifmib/fence_ifmib.py
+++ b/fence/agents/ifmib/fence_ifmib.py
@@ -12,6 +12,7 @@ import sys
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
+from fencing import fail_usage
 from fencing_snmp import *
 
 #BEGIN_VERSION_GENERATION
diff --git a/fence/agents/ilo/fence_ilo.py b/fence/agents/ilo/fence_ilo.py
index 48c829d..8171958 100644
--- a/fence/agents/ilo/fence_ilo.py
+++ b/fence/agents/ilo/fence_ilo.py
@@ -16,6 +16,7 @@ import atexit
 from xml.sax.saxutils import quoteattr
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
+from fencing import fail, EC_LOGIN_DENIED
 
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION="New ILO Agent - test release on steroids"
diff --git a/fence/agents/ipmilan/fence_ipmilan.py b/fence/agents/ipmilan/fence_ipmilan.py
index 7254c73..c5cab2b 100644
--- a/fence/agents/ipmilan/fence_ipmilan.py
+++ b/fence/agents/ipmilan/fence_ipmilan.py
@@ -5,6 +5,7 @@ import atexit
 from pipes import quote
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
+from fencing import SUDO_PATH, LOG_MODE_VERBOSE, fail_usage, is_executable
 
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION=""
diff --git a/fence/agents/ldom/fence_ldom.py b/fence/agents/ldom/fence_ldom.py
index 1bf1c49..ffa8fe4 100644
--- a/fence/agents/ldom/fence_ldom.py
+++ b/fence/agents/ldom/fence_ldom.py
@@ -11,6 +11,7 @@ import sys, re, pexpect, exceptions
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
+from fencing import fail_usage
 
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION="Logical Domains (LDoms) fence Agent"
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 6aab45b..40ee919 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -11,6 +11,9 @@ REDHAT_COPYRIGHT = ""
 BUILD_DATE = "March, 2008"
 #END_VERSION_GENERATION
 
+__all__ = [ 'atexit_handler', 'check_input', 'process_input', 'all_opt', 'show_docs',
+		'fence_login', 'fence_action' ]
+
 LOG_MODE_VERBOSE = 100
 LOG_MODE_QUIET = 0
 
diff --git a/fence/agents/lib/fencing_snmp.py.py b/fence/agents/lib/fencing_snmp.py.py
index 3faa295..a081052 100644
--- a/fence/agents/lib/fencing_snmp.py.py
+++ b/fence/agents/lib/fencing_snmp.py.py
@@ -4,6 +4,7 @@
 
 import re, pexpect
 from fencing import *
+from fencing import fail, fail_usage, EC_TIMED_OUT, LOG_MODE_VERBOSE
 
 ## do not add code here.
 #BEGIN_VERSION_GENERATION
diff --git a/fence/agents/lpar/fence_lpar.py b/fence/agents/lpar/fence_lpar.py
index 05e9b28..4278650 100644
--- a/fence/agents/lpar/fence_lpar.py
+++ b/fence/agents/lpar/fence_lpar.py
@@ -14,6 +14,7 @@ import sys, re
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
+from fencing import fail, fail_usage, EC_STATUS_HMC
 
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION=""
diff --git a/fence/agents/netio/fence_netio.py b/fence/agents/netio/fence_netio.py
index e483470..a1b4abf 100755
--- a/fence/agents/netio/fence_netio.py
+++ b/fence/agents/netio/fence_netio.py
@@ -4,6 +4,7 @@ import sys, re, pexpect
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
+from fencing import fspawn, fail, EC_LOGIN_DENIED, TELNET_PATH
 
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION=""
diff --git a/fence/agents/ovh/fence_ovh.py b/fence/agents/ovh/fence_ovh.py
index 647343c..9b1b373 100644
--- a/fence/agents/ovh/fence_ovh.py
+++ b/fence/agents/ovh/fence_ovh.py
@@ -16,6 +16,7 @@ from suds.client import Client
 from suds.xsd.doctor import ImportDoctor, Import
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
+from fencing import fail, fail_usage, EC_LOGIN_DENIED
 
 OVH_RESCUE_PRO_NETBOOT_ID = '28'
 OVH_HARD_DISK_NETBOOT_ID  = '1'
diff --git a/fence/agents/rhevm/fence_rhevm.py b/fence/agents/rhevm/fence_rhevm.py
index 9620c3a..ea10d4b 100644
--- a/fence/agents/rhevm/fence_rhevm.py
+++ b/fence/agents/rhevm/fence_rhevm.py
@@ -5,6 +5,7 @@ import pycurl, StringIO
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
+from fencing import fail, EC_STATUS, LOG_MODE_VERBOSE
 
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION="New RHEV-M Agent - test release on steroids"
diff --git a/fence/agents/sanbox2/fence_sanbox2.py b/fence/agents/sanbox2/fence_sanbox2.py
index e0c0647..a9d7c76 100644
--- a/fence/agents/sanbox2/fence_sanbox2.py
+++ b/fence/agents/sanbox2/fence_sanbox2.py
@@ -12,6 +12,7 @@ import sys, re, pexpect, exceptions
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
+from fencing import fail, EC_TIMED_OUT, EC_GENERIC_ERROR
 
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION="New Sanbox2 Agent - test release on steroids"
diff --git a/fence/agents/virsh/fence_virsh.py b/fence/agents/virsh/fence_virsh.py
index 170c089..fa6993e 100644
--- a/fence/agents/virsh/fence_virsh.py
+++ b/fence/agents/virsh/fence_virsh.py
@@ -6,9 +6,11 @@
 #
 
 import sys, re
+import time
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
+from fencing import fail_usage, SUDO_PATH
 
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION="Virsh fence agent"
diff --git a/fence/agents/vmware/fence_vmware.py b/fence/agents/vmware/fence_vmware.py
index f0f6023..9f19cb9 100644
--- a/fence/agents/vmware/fence_vmware.py
+++ b/fence/agents/vmware/fence_vmware.py
@@ -26,6 +26,7 @@ import sys, re, pexpect
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
+from fencing import fail, fail_usage, EC_TIMED_OUT, LOG_MODE_VERBOSE
 
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION="VMware Agent using VI Perl API and/or VIX vmrun command"
diff --git a/fence/agents/vmware_soap/fence_vmware_soap.py b/fence/agents/vmware_soap/fence_vmware_soap.py
index b55b56c..f944a04 100644
--- a/fence/agents/vmware_soap/fence_vmware_soap.py
+++ b/fence/agents/vmware_soap/fence_vmware_soap.py
@@ -9,6 +9,7 @@ sys.path.append("@FENCEAGENTSLIBDIR@")
 from suds.client import Client
 from suds.sudsobject import Property
 from fencing import *
+from fencing import fail, EC_STATUS, EC_LOGIN_DENIED, EC_INVALID_PRIVILEGES, EC_WAITING_ON, EC_WAITING_OFF
 
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION="New VMWare Agent - test release on steroids"
diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py
index bcb287b..da68b66 100644
--- a/fence/agents/wti/fence_wti.py
+++ b/fence/agents/wti/fence_wti.py
@@ -13,8 +13,10 @@
 
 import sys, re, pexpect
 import atexit
+import time
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
+from fencing import fspawn, fail, fail_usage, TELNET_PATH, EC_LOGIN_DENIED
 
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION="New WTI Agent - test release on steroids"
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Cluster-devel] [PATCH 08/15] [cleanup] Mark raw strings with r""
  2014-04-02 11:52 [Cluster-devel] [PATCH 01/15] [cleanup] Add missing spaces and fix tab/spaces indentation Marek 'marx' Grac
                   ` (5 preceding siblings ...)
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 07/15] [cleanup] Only symbols that should be used are exported from fencing library Marek 'marx' Grac
@ 2014-04-02 11:52 ` Marek 'marx' Grac
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 09/15] [cleanup] Only symbols that should be used are exported from fencing_snmp library Marek 'marx' Grac
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Marek 'marx' Grac @ 2014-04-02 11:52 UTC (permalink / raw)
  To: cluster-devel.redhat.com

---
 fence/agents/alom/fence_alom.py               | 2 +-
 fence/agents/apc/fence_apc.py                 | 6 +++---
 fence/agents/bladecenter/fence_bladecenter.py | 6 +++---
 fence/agents/brocade/fence_brocade.py         | 2 +-
 fence/agents/cisco_mds/fence_cisco_mds.py     | 4 ++--
 fence/agents/drac/fence_drac.py               | 2 +-
 fence/agents/drac5/fence_drac5.py             | 8 ++++----
 fence/agents/eps/fence_eps.py                 | 2 +-
 fence/agents/hds_cb/fence_hds_cb.py           | 4 ++--
 fence/agents/hpblade/fence_hpblade.py         | 4 ++--
 fence/agents/ilo/fence_ilo.py                 | 6 +++---
 fence/agents/ldom/fence_ldom.py               | 6 +++---
 fence/agents/lib/check_used_options.py        | 8 ++++----
 fence/agents/lib/fencing.py.py                | 4 ++--
 fence/agents/lpar/fence_lpar.py               | 2 +-
 fence/agents/rsb/fence_rsb.py                 | 2 +-
 fence/agents/sanbox2/fence_sanbox2.py         | 6 +++---
 fence/agents/virsh/fence_virsh.py             | 2 +-
 fence/agents/vmware/fence_vmware.py           | 2 +-
 19 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/fence/agents/alom/fence_alom.py b/fence/agents/alom/fence_alom.py
index 2844904..2a72d7e 100644
--- a/fence/agents/alom/fence_alom.py
+++ b/fence/agents/alom/fence_alom.py
@@ -37,7 +37,7 @@ def main():
 	atexit.register(atexit_handler)
 
 	all_opt["secure"]["default"] = "1"
-	all_opt["cmd_prompt"]["default"] = [ "sc\>\ " ]
+	all_opt["cmd_prompt"]["default"] = [ r"sc\>\ " ]
 
 	options = check_input(device_opt, process_input(device_opt))
 	options["telnet_over_ssh"] = 1
diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index 76b544b..3b17cd0 100644
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -73,7 +73,7 @@ def get_power_status(conn, options):
 		exp_result = conn.log_expect(options,
 				["Press <ENTER>" ] + options["--command-prompt"], int(options["--shell-timeout"]))
 		lines = conn.before.split("\n")
-		show_re = re.compile('(^|\x0D)\s*(\d+)- (.*?)\s+(ON|OFF)\s*')
+		show_re = re.compile(r'(^|\x0D)\s*(\d+)- (.*?)\s+(ON|OFF)\s*')
 		for x in lines:
 			res = show_re.search(x)
 			if (res != None):
@@ -185,7 +185,7 @@ def get_power_status5(conn, options):
 	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 	lines = conn.before.split("\n")
 
-	show_re = re.compile('^\s*(\d+): (.*): (On|Off)\s*$', re.IGNORECASE)
+	show_re = re.compile(r'^\s*(\d+): (.*): (On|Off)\s*$', re.IGNORECASE)
 
 	for x in lines:
 		res = show_re.search(x)
@@ -246,7 +246,7 @@ will block any necessary fencing actions."
 	## and continue with proper action
 	####
 	result = -1
-	firmware_version = re.compile('\s*v(\d)*\.').search(conn.before)
+	firmware_version = re.compile(r'\s*v(\d)*\.').search(conn.before)
 	if (firmware_version != None) and (firmware_version.group(1) == "5"):
 		result = fence_action(conn, options, set_power_status5, get_power_status5, get_power_status5)
 	else:
diff --git a/fence/agents/bladecenter/fence_bladecenter.py b/fence/agents/bladecenter/fence_bladecenter.py
index 34a8975..3bb02fc 100644
--- a/fence/agents/bladecenter/fence_bladecenter.py
+++ b/fence/agents/bladecenter/fence_bladecenter.py
@@ -25,7 +25,7 @@ BUILD_DATE="March, 2008"
 #END_VERSION_GENERATION
 
 def get_power_status(conn, options):
-	node_cmd = "system:blade\[" + options["--plug"] + "\]>"
+	node_cmd = r"system:blade\[" + options["--plug"] + r"\]>"
 
 	conn.send_eol("env -T system:blade[" + options["--plug"] + "]")
 	i = conn.log_expect(options, [ node_cmd, "system>" ] , int(options["--shell-timeout"]))
@@ -44,7 +44,7 @@ def get_power_status(conn, options):
 	return status.lower().strip()
 
 def set_power_status(conn, options):
-	node_cmd = "system:blade\[" + options["--plug"] + "\]>"
+	node_cmd = r"system:blade\[" + options["--plug"] + r"\]>"
 
 	conn.send_eol("env -T system:blade[" + options["--plug"] + "]")
 	i = conn.log_expect(options, [ node_cmd, "system>" ] , int(options["--shell-timeout"]))
@@ -71,7 +71,7 @@ def get_blades_list(conn, options):
 	conn.log_expect(options, node_cmd, int(options["--shell-timeout"]))
 
 	lines = conn.before.split("\r\n")
-	filter_re = re.compile("^\s*blade\[(\d+)\]\s+(.*?)\s*$")
+	filter_re = re.compile(r"^\s*blade\[(\d+)\]\s+(.*?)\s*$")
 	for blade_line in lines:
 		res = filter_re.search(blade_line)
 		if res != None:
diff --git a/fence/agents/brocade/fence_brocade.py b/fence/agents/brocade/fence_brocade.py
index 2deab5b..c6b2bfc 100644
--- a/fence/agents/brocade/fence_brocade.py
+++ b/fence/agents/brocade/fence_brocade.py
@@ -17,7 +17,7 @@ def get_power_status(conn, options):
 
 	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 
-	show_re = re.compile('^\s*Persistent Disable\s*(ON|OFF)\s*$', re.IGNORECASE)
+	show_re = re.compile(r'^\s*Persistent Disable\s*(ON|OFF)\s*$', re.IGNORECASE)
 	lines = conn.before.split("\n")
 
 	for x in lines:
diff --git a/fence/agents/cisco_mds/fence_cisco_mds.py b/fence/agents/cisco_mds/fence_cisco_mds.py
index 6af1e99..dc6c41b 100644
--- a/fence/agents/cisco_mds/fence_cisco_mds.py
+++ b/fence/agents/cisco_mds/fence_cisco_mds.py
@@ -37,7 +37,7 @@ PORT_OID = ""
 def cisco_port2oid(port):
 	port = port.lower()
 
-	nums = re.match('^fc(\d+)/(\d+)$', port)
+	nums = re.match(r'^fc(\d+)/(\d+)$', port)
 
 	if ((nums) and (len(nums.groups()))==2):
 		return "%s.%d.%d"% (PORT_ADMIN_STATUS_OID, int(nums.group(1))+21, int(nums.group(2))-1)
@@ -62,7 +62,7 @@ def get_outlets_status(conn, options):
 	res_fc = conn.walk(PORTS_OID, 30)
 	res_aliases = array_to_dict(conn.walk(ALIASES_OID, 30))
 
-	fc_re = re.compile('^"fc\d+/\d+"$')
+	fc_re = re.compile(r'^"fc\d+/\d+"$')
 
 	for x in res_fc:
 		if fc_re.match(x[1]):
diff --git a/fence/agents/drac/fence_drac.py b/fence/agents/drac/fence_drac.py
index ba08ee7..396f09e 100644
--- a/fence/agents/drac/fence_drac.py
+++ b/fence/agents/drac/fence_drac.py
@@ -14,7 +14,7 @@ BUILD_DATE=""
 def get_power_status(conn, options):
 	conn.send_eol("getmodinfo")
 	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
-	status = re.compile("\s+(on|off)\s+", re.IGNORECASE).search(conn.before).group(1)
+	status = re.compile(r"\s+(on|off)\s+", re.IGNORECASE).search(conn.before).group(1)
 	return (status.lower().strip())
 
 def set_power_status(conn, options):
diff --git a/fence/agents/drac5/fence_drac5.py b/fence/agents/drac5/fence_drac5.py
index 642dcda..cdf4f4f 100644
--- a/fence/agents/drac5/fence_drac5.py
+++ b/fence/agents/drac5/fence_drac5.py
@@ -35,7 +35,7 @@ def get_power_status(conn, options):
 
 		conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 
-		status = re.compile("(^|: )(ON|OFF|Powering ON|Powering OFF)\s*$",
+		status = re.compile(r"(^|: )(ON|OFF|Powering ON|Powering OFF)\s*$",
 				re.IGNORECASE | re.MULTILINE).search(conn.before).group(2)
 
 	if status.lower().strip() in ["on", "powering on", "powering off"]:
@@ -70,7 +70,7 @@ def get_list_devices(conn, options):
 	if options["--drac-version"] == "DRAC CMC":
 		conn.send_eol("getmodinfo")
 
-		list_re = re.compile("^([^\s]*?)\s+Present\s*(ON|OFF)\s*.*$")
+		list_re = re.compile(r"^([^\s]*?)\s+Present\s*(ON|OFF)\s*.*$")
 		conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 		for line in conn.before.splitlines():
 			if (list_re.search(line)):
@@ -78,7 +78,7 @@ def get_list_devices(conn, options):
 	elif options["--drac-version"] == "DRAC MC":
 		conn.send_eol("getmodinfo")
 
-		list_re = re.compile("^\s*([^\s]*)\s*---->\s*(.*?)\s+Present\s*(ON|OFF)\s*.*$")
+		list_re = re.compile(r"^\s*([^\s]*)\s*---->\s*(.*?)\s+Present\s*(ON|OFF)\s*.*$")
 		conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
 		for line in conn.before.splitlines():
 			if (list_re.search(line)):
@@ -110,7 +110,7 @@ def main():
 
 	define_new_opts()
 
-	all_opt["cmd_prompt"]["default"] = [ "\$", "DRAC\/MC:" ]
+	all_opt["cmd_prompt"]["default"] = [ r"\$", r"DRAC\/MC:" ]
 
 	options = check_input(device_opt, process_input(device_opt))
 
diff --git a/fence/agents/eps/fence_eps.py b/fence/agents/eps/fence_eps.py
index 3c4be8d..daffab4 100644
--- a/fence/agents/eps/fence_eps.py
+++ b/fence/agents/eps/fence_eps.py
@@ -71,7 +71,7 @@ def get_power_status(conn, options):
 	ret_val = eps_run_command(options,"")
 
 	result = {}
-	status = re.findall("p(\d{2})=(0|1)\s*\<br\>", ret_val.lower())
+	status = re.findall(r"p(\d{2})=(0|1)\s*\<br\>", ret_val.lower())
 	for out_num, out_stat in status:
 		result[out_num] = ("",(out_stat=="1" and "on" or "off"))
 
diff --git a/fence/agents/hds_cb/fence_hds_cb.py b/fence/agents/hds_cb/fence_hds_cb.py
index 78754fc..70ca185 100755
--- a/fence/agents/hds_cb/fence_hds_cb.py
+++ b/fence/agents/hds_cb/fence_hds_cb.py
@@ -21,7 +21,7 @@ REDHAT_COPYRIGHT=""
 BUILD_DATE="November, 2012"
 #END_VERSION_GENERATION
 
-RE_STATUS_LINE = "^([0-9]+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+).*$"
+RE_STATUS_LINE = r"^([0-9]+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+).*$"
 
 def get_power_status(conn, options):
 	#### Maybe should put a conn.log_expect here to make sure
@@ -113,7 +113,7 @@ def main():
 	atexit.register(atexit_handler)
 
 	all_opt["power_wait"]["default"] = "5"
-	all_opt["cmd_prompt"]["default"] = [ "\) :" ]
+	all_opt["cmd_prompt"]["default"] = [ r"\) :" ]
 
 	options = check_input(device_opt, process_input(device_opt))
 
diff --git a/fence/agents/hpblade/fence_hpblade.py b/fence/agents/hpblade/fence_hpblade.py
index 44032d3..6b883db 100644
--- a/fence/agents/hpblade/fence_hpblade.py
+++ b/fence/agents/hpblade/fence_hpblade.py
@@ -22,7 +22,7 @@ def get_power_status(conn, options):
 	conn.send_eol("show server status " + options["--plug"])
 	conn.log_expect(options, options["--command-prompt"] , int(options["--shell-timeout"]))
 
-	power_re = re.compile("^\s*Power: (.*?)\s*$")
+	power_re = re.compile(r"^\s*Power: (.*?)\s*$")
 	status = "unknown"
 	for line in conn.before.splitlines():
 		res = power_re.search(line)
@@ -50,7 +50,7 @@ def get_blades_list(conn, options):
 	conn.send_eol("show server list" )
 	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 
-	list_re = re.compile("^\s*(.*?)\s+(.*?)\s+(.*?)\s+OK\s+(.*?)\s+(.*?)\s*$")
+	list_re = re.compile(r"^\s*(.*?)\s+(.*?)\s+(.*?)\s+OK\s+(.*?)\s+(.*?)\s*$")
 	for line in conn.before.splitlines():
 		res = list_re.search(line)
 		if res != None:
diff --git a/fence/agents/ilo/fence_ilo.py b/fence/agents/ilo/fence_ilo.py
index 8171958..8719573 100644
--- a/fence/agents/ilo/fence_ilo.py
+++ b/fence/agents/ilo/fence_ilo.py
@@ -109,11 +109,11 @@ the iLO card through an XML stream."
 		if options["--ribcl-version"] >= 2:
 			conn.send("<RIB_INFO MODE=\"read\"><GET_FW_VERSION />\r\n")
 			conn.send("</RIB_INFO>\r\n")
-			conn.log_expect(options, "<GET_FW_VERSION\s*\n", int(options["--shell-timeout"]))
+			conn.log_expect(options, r"<GET_FW_VERSION\s*\n", int(options["--shell-timeout"]))
 			conn.log_expect(options, "/>", int(options["--shell-timeout"]))
-			options["fw_version"] = float(re.compile("FIRMWARE_VERSION\s*=\s*\"(.*?)\"",
+			options["fw_version"] = float(re.compile(r"FIRMWARE_VERSION\s*=\s*\"(.*?)\"",
 					re.IGNORECASE).search(conn.before).group(1))
-			options["fw_processor"] = re.compile("MANAGEMENT_PROCESSOR\s*=\s*\"(.*?)\"",
+			options["fw_processor"] = re.compile(r"MANAGEMENT_PROCESSOR\s*=\s*\"(.*?)\"",
 					re.IGNORECASE).search(conn.before).group(1)
 		conn.send("</LOGIN>\r\n")
 	except pexpect.TIMEOUT:
diff --git a/fence/agents/ldom/fence_ldom.py b/fence/agents/ldom/fence_ldom.py
index ffa8fe4..7545eed 100644
--- a/fence/agents/ldom/fence_ldom.py
+++ b/fence/agents/ldom/fence_ldom.py
@@ -19,7 +19,7 @@ REDHAT_COPYRIGHT=""
 BUILD_DATE=""
 #END_VERSION_GENERATION
 
-COMMAND_PROMPT_REG = "\[PEXPECT\]$"
+COMMAND_PROMPT_REG = r"\[PEXPECT\]$"
 COMMAND_PROMPT_NEW = "[PEXPECT]"
 
 # Start comunicating after login. Prepare good environment.
@@ -44,7 +44,7 @@ def get_power_status(conn, options):
 	fa_status = 0
 
 	for line in conn.before.splitlines():
-		domain = re.search("^(\S+)\s+(\S+)\s+.*$", line)
+		domain = re.search(r"^(\S+)\s+(\S+)\s+.*$", line)
 
 		if (domain!=None):
 			if ((fa_status==0) and (domain.group(1)=="NAME") and (domain.group(2)=="STATE")):
@@ -75,7 +75,7 @@ def main():
 	atexit.register(atexit_handler)
 
 	all_opt["secure"]["default"] = "1"
-	all_opt["cmd_prompt"]["default"] = [ "\ $" ]
+	all_opt["cmd_prompt"]["default"] = [ r"\ $" ]
 
 	options = check_input(device_opt, process_input(device_opt))
 
diff --git a/fence/agents/lib/check_used_options.py b/fence/agents/lib/check_used_options.py
index 2d2abbc..92a2ae6 100755
--- a/fence/agents/lib/check_used_options.py
+++ b/fence/agents/lib/check_used_options.py
@@ -25,8 +25,8 @@ def main():
 
 	## all_opt defined in fence agent are found
 	agent_file = open(agent)
-	opt_re = re.compile("\s*all_opt\[\"([^\"]*)\"\] = {")
-	opt_longopt_re = re.compile("\s*\"longopt\" : \"([^\"]*)\"")
+	opt_re = re.compile(r"\s*all_opt\[\"([^\"]*)\"\] = {")
+	opt_longopt_re = re.compile(r"\s*\"longopt\" : \"([^\"]*)\"")
 
 	in_opt = False
 	for line in agent_file:
@@ -38,8 +38,8 @@ def main():
 
 	## check if all options are defined
 	agent_file = open(agent)
-	option_use_re = re.compile("options\[\"(-[^\"]*)\"\]")
-	option_has_re = re.compile("options.has_key\(\"(-[^\"]*)\"\)")
+	option_use_re = re.compile(r"options\[\"(-[^\"]*)\"\]")
+	option_has_re = re.compile(r"options.has_key\(\"(-[^\"]*)\"\)")
 
 	counter = 0
 	without_errors = True
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 40ee919..47d6e83 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -489,7 +489,7 @@ def metadata(avail_opt, options, docs):
 
 			mixed = all_opt[option]["help"]
 			## split it between option and help text
-			res = re.compile("^(.*--\S+)\s+", re.IGNORECASE | re.S).search(mixed)
+			res = re.compile(r"^(.*--\S+)\s+", re.IGNORECASE | re.S).search(mixed)
 			if (None != res):
 				mixed = res.group(1)
 			mixed = mixed.replace("<", "&lt;").replace(">", "&gt;")
@@ -950,7 +950,7 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
 
 	return result
 
-def fence_login(options, re_login_string = "(login\s*: )|(Login Name:  )|(username: )|(User Name :)"):
+def fence_login(options, re_login_string = r"(login\s*: )|(Login Name:  )|(username: )|(User Name :)"):
 	force_ipvx = ""
 
 	if (options.has_key("--inet6-only")):
diff --git a/fence/agents/lpar/fence_lpar.py b/fence/agents/lpar/fence_lpar.py
index 4278650..630b2ca 100644
--- a/fence/agents/lpar/fence_lpar.py
+++ b/fence/agents/lpar/fence_lpar.py
@@ -131,7 +131,7 @@ def main():
 
 	all_opt["login_timeout"]["default"] = "15"
 	all_opt["secure"]["default"] = "1"
-	all_opt["cmd_prompt"]["default"] = [ ":~>", "]\$", "\$ " ]
+	all_opt["cmd_prompt"]["default"] = [ r":~>", r"]\$", r"\$ " ]
 
 	options = check_input(device_opt, process_input(device_opt))
 
diff --git a/fence/agents/rsb/fence_rsb.py b/fence/agents/rsb/fence_rsb.py
index 89fb304..af3a2e4 100755
--- a/fence/agents/rsb/fence_rsb.py
+++ b/fence/agents/rsb/fence_rsb.py
@@ -14,7 +14,7 @@ BUILD_DATE=""
 def get_power_status(conn, options):
 	conn.send("2")
 	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
-	status = re.compile("Power Status[\s]*: (on|off)", re.IGNORECASE).search(conn.before).group(1)
+	status = re.compile(r"Power Status[\s]*: (on|off)", re.IGNORECASE).search(conn.before).group(1)
 	conn.send("0")
 	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 
diff --git a/fence/agents/sanbox2/fence_sanbox2.py b/fence/agents/sanbox2/fence_sanbox2.py
index a9d7c76..0dfab37 100644
--- a/fence/agents/sanbox2/fence_sanbox2.py
+++ b/fence/agents/sanbox2/fence_sanbox2.py
@@ -37,7 +37,7 @@ def get_power_status(conn, options):
 			pass
 		fail(EC_TIMED_OUT)
 
-	status = re.compile(".*AdminState\s+(online|offline)\s+",
+	status = re.compile(r".*AdminState\s+(online|offline)\s+",
 			re.IGNORECASE | re.MULTILINE).search(conn.before).group(1)
 
 	try:
@@ -82,7 +82,7 @@ def get_list_devices(conn, options):
 		conn.send_eol("show port")
 		conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 
-		list_re = re.compile("^\s+(\d+?)\s+(Online|Offline)\s+", re.IGNORECASE)
+		list_re = re.compile(r"^\s+(\d+?)\s+(Online|Offline)\s+", re.IGNORECASE)
 		for line in conn.before.splitlines():
 			if (list_re.search(line)):
 				status = {
@@ -129,7 +129,7 @@ because the connection will block any necessary fencing actions."
 	conn.send_eol("admin start")
 	conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
 
-	if (re.search("\(admin\)", conn.before, re.MULTILINE) == None):
+	if (re.search(r"\(admin\)", conn.before, re.MULTILINE) == None):
 		## Someone else is in admin section, we can't enable/disable
 		## ports so we will rather exit
 		sys.stderr.write("Failed: Unable to switch to admin section\n")
diff --git a/fence/agents/virsh/fence_virsh.py b/fence/agents/virsh/fence_virsh.py
index fa6993e..f03ea74 100644
--- a/fence/agents/virsh/fence_virsh.py
+++ b/fence/agents/virsh/fence_virsh.py
@@ -36,7 +36,7 @@ def get_outlets_status(conn, options):
 	fa_status = 0
 
 	for line in conn.before.splitlines():
-		domain = re.search("^\s*(\S+)\s+(\S+)\s+(\S+).*$", line)
+		domain = re.search(r"^\s*(\S+)\s+(\S+)\s+(\S+).*$", line)
 
 		if (domain!=None):
 			if ((fa_status==0) and (domain.group(1).lower()=="id") and (domain.group(2).lower()=="name")):
diff --git a/fence/agents/vmware/fence_vmware.py b/fence/agents/vmware/fence_vmware.py
index 9f19cb9..42ac505 100644
--- a/fence/agents/vmware/fence_vmware.py
+++ b/fence/agents/vmware/fence_vmware.py
@@ -248,7 +248,7 @@ def set_power_status(conn, options):
 # Returns True, if user uses supported vmrun version (currently >=2.0.0) otherwise False.
 def vmware_is_supported_vmrun_version(options):
 	vmware_help_str = vmware_run_command(options, False, "", 0)
-	version_re = re.search("vmrun version (\d\.(\d[\.]*)*)", vmware_help_str.lower())
+	version_re = re.search(r"vmrun version (\d\.(\d[\.]*)*)", vmware_help_str.lower())
 	if (version_re==None):
 		return False   # Looks like this "vmrun" is not real vmrun
 
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Cluster-devel] [PATCH 09/15] [cleanup] Only symbols that should be used are exported from fencing_snmp library
  2014-04-02 11:52 [Cluster-devel] [PATCH 01/15] [cleanup] Add missing spaces and fix tab/spaces indentation Marek 'marx' Grac
                   ` (6 preceding siblings ...)
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 08/15] [cleanup] Mark raw strings with r"" Marek 'marx' Grac
@ 2014-04-02 11:52 ` Marek 'marx' Grac
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 10/15] [cleanup] Errors when encountering mixed space/tab in python Marek 'marx' Grac
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Marek 'marx' Grac @ 2014-04-02 11:52 UTC (permalink / raw)
  To: cluster-devel.redhat.com

---
 fence/agents/lib/fencing_snmp.py.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fence/agents/lib/fencing_snmp.py.py b/fence/agents/lib/fencing_snmp.py.py
index a081052..c5688be 100644
--- a/fence/agents/lib/fencing_snmp.py.py
+++ b/fence/agents/lib/fencing_snmp.py.py
@@ -6,6 +6,8 @@ import re, pexpect
 from fencing import *
 from fencing import fail, fail_usage, EC_TIMED_OUT, LOG_MODE_VERBOSE
 
+__all__ = [ 'FencingSnmp', 'snmp_define_defaults' ]
+
 ## do not add code here.
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION = ""
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Cluster-devel] [PATCH 10/15] [cleanup] Errors when encountering mixed space/tab in python
  2014-04-02 11:52 [Cluster-devel] [PATCH 01/15] [cleanup] Add missing spaces and fix tab/spaces indentation Marek 'marx' Grac
                   ` (7 preceding siblings ...)
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 09/15] [cleanup] Only symbols that should be used are exported from fencing_snmp library Marek 'marx' Grac
@ 2014-04-02 11:52 ` Marek 'marx' Grac
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 11/15] [cleanup] Mark raw strings with r"" in fence_virsh Marek 'marx' Grac
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Marek 'marx' Grac @ 2014-04-02 11:52 UTC (permalink / raw)
  To: cluster-devel.redhat.com

---
 fence/agents/alom/fence_alom.py                 | 2 +-
 fence/agents/amt/fence_amt.py                   | 2 +-
 fence/agents/apc/fence_apc.py                   | 2 +-
 fence/agents/apc_snmp/fence_apc_snmp.py         | 2 +-
 fence/agents/bladecenter/fence_bladecenter.py   | 2 +-
 fence/agents/brocade/fence_brocade.py           | 2 +-
 fence/agents/cisco_mds/fence_cisco_mds.py       | 2 +-
 fence/agents/cisco_ucs/fence_cisco_ucs.py       | 2 +-
 fence/agents/drac/fence_drac.py                 | 2 +-
 fence/agents/drac5/fence_drac5.py               | 2 +-
 fence/agents/dummy/fence_dummy.py               | 2 +-
 fence/agents/eaton_snmp/fence_eaton_snmp.py     | 2 +-
 fence/agents/eps/fence_eps.py                   | 2 +-
 fence/agents/hds_cb/fence_hds_cb.py             | 2 +-
 fence/agents/hpblade/fence_hpblade.py           | 2 +-
 fence/agents/ibmblade/fence_ibmblade.py         | 2 +-
 fence/agents/ifmib/fence_ifmib.py               | 2 +-
 fence/agents/ilo/fence_ilo.py                   | 2 +-
 fence/agents/ilo_mp/fence_ilo_mp.py             | 2 +-
 fence/agents/intelmodular/fence_intelmodular.py | 2 +-
 fence/agents/ipdu/fence_ipdu.py                 | 2 +-
 fence/agents/ipmilan/fence_ipmilan.py           | 2 +-
 fence/agents/ldom/fence_ldom.py                 | 2 +-
 fence/agents/lib/check_used_options.py          | 2 +-
 fence/agents/lib/fencing.py.py                  | 2 +-
 fence/agents/lib/fencing_snmp.py.py             | 2 +-
 fence/agents/lib/transfer.py                    | 2 +-
 fence/agents/lpar/fence_lpar.py                 | 2 +-
 fence/agents/netio/fence_netio.py               | 2 +-
 fence/agents/ovh/fence_ovh.py                   | 2 +-
 fence/agents/rhevm/fence_rhevm.py               | 2 +-
 fence/agents/rsa/fence_rsa.py                   | 2 +-
 fence/agents/rsb/fence_rsb.py                   | 2 +-
 fence/agents/sanbox2/fence_sanbox2.py           | 2 +-
 fence/agents/virsh/fence_virsh.py               | 2 +-
 fence/agents/vmware/fence_vmware.py             | 2 +-
 fence/agents/vmware_soap/fence_vmware_soap.py   | 2 +-
 fence/agents/wti/fence_wti.py                   | 2 +-
 fence/agents/xenapi/fence_xenapi.py             | 2 +-
 39 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/fence/agents/alom/fence_alom.py b/fence/agents/alom/fence_alom.py
index 2a72d7e..c2af527 100644
--- a/fence/agents/alom/fence_alom.py
+++ b/fence/agents/alom/fence_alom.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 # The Following Agent Has Been Tested On:
 #
diff --git a/fence/agents/amt/fence_amt.py b/fence/agents/amt/fence_amt.py
index 346677e..f7e8cc0 100644
--- a/fence/agents/amt/fence_amt.py
+++ b/fence/agents/amt/fence_amt.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 import sys, subprocess, re
 import atexit
diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index 3b17cd0..1e86c07 100644
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 #####
 ##
diff --git a/fence/agents/apc_snmp/fence_apc_snmp.py b/fence/agents/apc_snmp/fence_apc_snmp.py
index b07d04a..2461476 100644
--- a/fence/agents/apc_snmp/fence_apc_snmp.py
+++ b/fence/agents/apc_snmp/fence_apc_snmp.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 # The Following agent has been tested on:
 # - APC Switched Rack PDU - SNMP v1
diff --git a/fence/agents/bladecenter/fence_bladecenter.py b/fence/agents/bladecenter/fence_bladecenter.py
index 3bb02fc..0f59f55 100644
--- a/fence/agents/bladecenter/fence_bladecenter.py
+++ b/fence/agents/bladecenter/fence_bladecenter.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 #####
 ##
diff --git a/fence/agents/brocade/fence_brocade.py b/fence/agents/brocade/fence_brocade.py
index c6b2bfc..a60355d 100644
--- a/fence/agents/brocade/fence_brocade.py
+++ b/fence/agents/brocade/fence_brocade.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 import sys, re
 import atexit
diff --git a/fence/agents/cisco_mds/fence_cisco_mds.py b/fence/agents/cisco_mds/fence_cisco_mds.py
index dc6c41b..6cc189f 100644
--- a/fence/agents/cisco_mds/fence_cisco_mds.py
+++ b/fence/agents/cisco_mds/fence_cisco_mds.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 # The Following agent has been tested on:
 # - Cisco MDS UROS 9134 FC (1 Slot) Chassis ("1/2/4 10 Gbps FC/Supervisor-2") Motorola, e500v2
diff --git a/fence/agents/cisco_ucs/fence_cisco_ucs.py b/fence/agents/cisco_ucs/fence_cisco_ucs.py
index 81a911e..95dd2b4 100644
--- a/fence/agents/cisco_ucs/fence_cisco_ucs.py
+++ b/fence/agents/cisco_ucs/fence_cisco_ucs.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 import sys, re
 import pycurl, StringIO
diff --git a/fence/agents/drac/fence_drac.py b/fence/agents/drac/fence_drac.py
index 396f09e..b858d62 100644
--- a/fence/agents/drac/fence_drac.py
+++ b/fence/agents/drac/fence_drac.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 import sys, re
 import atexit
diff --git a/fence/agents/drac5/fence_drac5.py b/fence/agents/drac5/fence_drac5.py
index cdf4f4f..7d8fe9a 100644
--- a/fence/agents/drac5/fence_drac5.py
+++ b/fence/agents/drac5/fence_drac5.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 #####
 ##
diff --git a/fence/agents/dummy/fence_dummy.py b/fence/agents/dummy/fence_dummy.py
index dc65bee..e7c235a 100644
--- a/fence/agents/dummy/fence_dummy.py
+++ b/fence/agents/dummy/fence_dummy.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 import sys, random
 import time
diff --git a/fence/agents/eaton_snmp/fence_eaton_snmp.py b/fence/agents/eaton_snmp/fence_eaton_snmp.py
index a329aeb..f519be8 100644
--- a/fence/agents/eaton_snmp/fence_eaton_snmp.py
+++ b/fence/agents/eaton_snmp/fence_eaton_snmp.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 # The Following agent has been tested on:
 # - Eaton ePDU Managed - SNMP v1
diff --git a/fence/agents/eps/fence_eps.py b/fence/agents/eps/fence_eps.py
index daffab4..f8230e5 100644
--- a/fence/agents/eps/fence_eps.py
+++ b/fence/agents/eps/fence_eps.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 # The Following Agent Has Been Tested On:
 # ePowerSwitch 8M+ version 1.0.0.4
diff --git a/fence/agents/hds_cb/fence_hds_cb.py b/fence/agents/hds_cb/fence_hds_cb.py
index 70ca185..f895fd3 100755
--- a/fence/agents/hds_cb/fence_hds_cb.py
+++ b/fence/agents/hds_cb/fence_hds_cb.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 #####
 ##
diff --git a/fence/agents/hpblade/fence_hpblade.py b/fence/agents/hpblade/fence_hpblade.py
index 6b883db..636c77d 100644
--- a/fence/agents/hpblade/fence_hpblade.py
+++ b/fence/agents/hpblade/fence_hpblade.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 #####
 ##
diff --git a/fence/agents/ibmblade/fence_ibmblade.py b/fence/agents/ibmblade/fence_ibmblade.py
index 1e60e7d..43bc73e 100644
--- a/fence/agents/ibmblade/fence_ibmblade.py
+++ b/fence/agents/ibmblade/fence_ibmblade.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 import sys
 import atexit
diff --git a/fence/agents/ifmib/fence_ifmib.py b/fence/agents/ifmib/fence_ifmib.py
index 3ecc85d..350ce71 100644
--- a/fence/agents/ifmib/fence_ifmib.py
+++ b/fence/agents/ifmib/fence_ifmib.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 # The Following agent has been tested on:
 # - Cisco MDS UROS 9134 FC (1 Slot) Chassis ("1/2/4 10 Gbps FC/Supervisor-2") Motorola, e500v2
diff --git a/fence/agents/ilo/fence_ilo.py b/fence/agents/ilo/fence_ilo.py
index 8719573..f45e749 100644
--- a/fence/agents/ilo/fence_ilo.py
+++ b/fence/agents/ilo/fence_ilo.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 #####
 ##
diff --git a/fence/agents/ilo_mp/fence_ilo_mp.py b/fence/agents/ilo_mp/fence_ilo_mp.py
index c76c281..1d874c1 100644
--- a/fence/agents/ilo_mp/fence_ilo_mp.py
+++ b/fence/agents/ilo_mp/fence_ilo_mp.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 import sys, re
 import atexit
diff --git a/fence/agents/intelmodular/fence_intelmodular.py b/fence/agents/intelmodular/fence_intelmodular.py
index bd1faee..320b2db 100644
--- a/fence/agents/intelmodular/fence_intelmodular.py
+++ b/fence/agents/intelmodular/fence_intelmodular.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 # Tested with an Intel MFSYS25 using firmware package 2.6 Should work with an
 # MFSYS35 as well.
diff --git a/fence/agents/ipdu/fence_ipdu.py b/fence/agents/ipdu/fence_ipdu.py
index c1fc368..62a2df4 100644
--- a/fence/agents/ipdu/fence_ipdu.py
+++ b/fence/agents/ipdu/fence_ipdu.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 # The Following agent has been tested on:
 #   IBM iPDU model 46M4002
diff --git a/fence/agents/ipmilan/fence_ipmilan.py b/fence/agents/ipmilan/fence_ipmilan.py
index c5cab2b..93e87ae 100644
--- a/fence/agents/ipmilan/fence_ipmilan.py
+++ b/fence/agents/ipmilan/fence_ipmilan.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 import sys, shlex, subprocess, re, os
 import atexit
diff --git a/fence/agents/ldom/fence_ldom.py b/fence/agents/ldom/fence_ldom.py
index 7545eed..65c810b 100644
--- a/fence/agents/ldom/fence_ldom.py
+++ b/fence/agents/ldom/fence_ldom.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 ##
 ## The Following Agent Has Been Tested On - LDOM 1.0.3
diff --git a/fence/agents/lib/check_used_options.py b/fence/agents/lib/check_used_options.py
index 92a2ae6..ce74fa9 100755
--- a/fence/agents/lib/check_used_options.py
+++ b/fence/agents/lib/check_used_options.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 ## Check if fence agent uses only options["--??"] which are defined in fencing library or
 ## fence agent itself
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 47d6e83..3409b60 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 import sys, getopt, time, os, uuid, pycurl, stat
 import pexpect, re, syslog
diff --git a/fence/agents/lib/fencing_snmp.py.py b/fence/agents/lib/fencing_snmp.py.py
index c5688be..e65a551 100644
--- a/fence/agents/lib/fencing_snmp.py.py
+++ b/fence/agents/lib/fencing_snmp.py.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 # For example of use please see fence_cisco_mds
 
diff --git a/fence/agents/lib/transfer.py b/fence/agents/lib/transfer.py
index ddf2486..b7a39db 100755
--- a/fence/agents/lib/transfer.py
+++ b/fence/agents/lib/transfer.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 from fencing import *
 
diff --git a/fence/agents/lpar/fence_lpar.py b/fence/agents/lpar/fence_lpar.py
index 630b2ca..304ebe4 100644
--- a/fence/agents/lpar/fence_lpar.py
+++ b/fence/agents/lpar/fence_lpar.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 #####
 ##
diff --git a/fence/agents/netio/fence_netio.py b/fence/agents/netio/fence_netio.py
index a1b4abf..4708ff6 100755
--- a/fence/agents/netio/fence_netio.py
+++ b/fence/agents/netio/fence_netio.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 import sys, re, pexpect
 import atexit
diff --git a/fence/agents/ovh/fence_ovh.py b/fence/agents/ovh/fence_ovh.py
index 9b1b373..6602b8e 100644
--- a/fence/agents/ovh/fence_ovh.py
+++ b/fence/agents/ovh/fence_ovh.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 # Copyright 2013 Adrian Gibanel Lopez (bTactic)
 # Adrian Gibanel improved this script at 2013 to add verification of success and to output metadata
 
diff --git a/fence/agents/rhevm/fence_rhevm.py b/fence/agents/rhevm/fence_rhevm.py
index ea10d4b..8c28b2d 100644
--- a/fence/agents/rhevm/fence_rhevm.py
+++ b/fence/agents/rhevm/fence_rhevm.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 import sys, re
 import pycurl, StringIO
diff --git a/fence/agents/rsa/fence_rsa.py b/fence/agents/rsa/fence_rsa.py
index 4e855a2..ba93709 100644
--- a/fence/agents/rsa/fence_rsa.py
+++ b/fence/agents/rsa/fence_rsa.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 #####
 ##
diff --git a/fence/agents/rsb/fence_rsb.py b/fence/agents/rsb/fence_rsb.py
index af3a2e4..b72d295 100755
--- a/fence/agents/rsb/fence_rsb.py
+++ b/fence/agents/rsb/fence_rsb.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 import sys, re
 import atexit
diff --git a/fence/agents/sanbox2/fence_sanbox2.py b/fence/agents/sanbox2/fence_sanbox2.py
index 0dfab37..6750252 100644
--- a/fence/agents/sanbox2/fence_sanbox2.py
+++ b/fence/agents/sanbox2/fence_sanbox2.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 #####
 ##
diff --git a/fence/agents/virsh/fence_virsh.py b/fence/agents/virsh/fence_virsh.py
index f03ea74..c1cbc65 100644
--- a/fence/agents/virsh/fence_virsh.py
+++ b/fence/agents/virsh/fence_virsh.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 # The Following Agent Has Been Tested On:
 #
diff --git a/fence/agents/vmware/fence_vmware.py b/fence/agents/vmware/fence_vmware.py
index 42ac505..3a7bc61 100644
--- a/fence/agents/vmware/fence_vmware.py
+++ b/fence/agents/vmware/fence_vmware.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 #
 # The Following agent has been tested on:
diff --git a/fence/agents/vmware_soap/fence_vmware_soap.py b/fence/agents/vmware_soap/fence_vmware_soap.py
index f944a04..ccdbac1 100644
--- a/fence/agents/vmware_soap/fence_vmware_soap.py
+++ b/fence/agents/vmware_soap/fence_vmware_soap.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 import sys, time
 import shutil, tempfile, suds
diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py
index da68b66..01667fc 100644
--- a/fence/agents/wti/fence_wti.py
+++ b/fence/agents/wti/fence_wti.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 
 #####
 ##
diff --git a/fence/agents/xenapi/fence_xenapi.py b/fence/agents/xenapi/fence_xenapi.py
index 8b9857c..3b6454c 100644
--- a/fence/agents/xenapi/fence_xenapi.py
+++ b/fence/agents/xenapi/fence_xenapi.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
 #
 #############################################################################
 # Copyright 2011 Matthew Clark
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Cluster-devel] [PATCH 11/15] [cleanup] Mark raw strings with r"" in fence_virsh
  2014-04-02 11:52 [Cluster-devel] [PATCH 01/15] [cleanup] Add missing spaces and fix tab/spaces indentation Marek 'marx' Grac
                   ` (8 preceding siblings ...)
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 10/15] [cleanup] Errors when encountering mixed space/tab in python Marek 'marx' Grac
@ 2014-04-02 11:52 ` Marek 'marx' Grac
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 12/15] [cleanup] Remove snmp_define_defaults() Marek 'marx' Grac
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Marek 'marx' Grac @ 2014-04-02 11:52 UTC (permalink / raw)
  To: cluster-devel.redhat.com

---
 fence/agents/virsh/fence_virsh.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fence/agents/virsh/fence_virsh.py b/fence/agents/virsh/fence_virsh.py
index c1cbc65..cbdb399 100644
--- a/fence/agents/virsh/fence_virsh.py
+++ b/fence/agents/virsh/fence_virsh.py
@@ -73,8 +73,8 @@ def main():
 	atexit.register(atexit_handler)
 
 	all_opt["secure"]["default"] = "1"
-	all_opt["cmd_prompt"]["default"] = [ "\[EXPECT\]#\ " ]
-	all_opt["ssh_options"]["default"] = "-t '/bin/bash -c \"PS1=\[EXPECT\]#\  /bin/bash --noprofile --norc\"'"
+	all_opt["cmd_prompt"]["default"] = [ r"\[EXPECT\]#\ " ]
+	all_opt["ssh_options"]["default"] = "-t '/bin/bash -c \"" + r"PS1=\[EXPECT\]#\  " + "/bin/bash --noprofile --norc\"'"
 
 	options = check_input(device_opt, process_input(device_opt))
 
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Cluster-devel] [PATCH 12/15] [cleanup] Remove snmp_define_defaults()
  2014-04-02 11:52 [Cluster-devel] [PATCH 01/15] [cleanup] Add missing spaces and fix tab/spaces indentation Marek 'marx' Grac
                   ` (9 preceding siblings ...)
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 11/15] [cleanup] Mark raw strings with r"" in fence_virsh Marek 'marx' Grac
@ 2014-04-02 11:52 ` Marek 'marx' Grac
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 13/15] [cleanup] Remove unused arguments Marek 'marx' Grac
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Marek 'marx' Grac @ 2014-04-02 11:52 UTC (permalink / raw)
  To: cluster-devel.redhat.com

This function is always called for SNMP fence agents so it is possible to run it automatically.
---
 fence/agents/apc_snmp/fence_apc_snmp.py         | 11 +++--------
 fence/agents/cisco_mds/fence_cisco_mds.py       |  4 +---
 fence/agents/eaton_snmp/fence_eaton_snmp.py     |  4 +---
 fence/agents/ibmblade/fence_ibmblade.py         |  3 +--
 fence/agents/ifmib/fence_ifmib.py               |  3 +--
 fence/agents/intelmodular/fence_intelmodular.py |  4 +---
 fence/agents/ipdu/fence_ipdu.py                 |  3 +--
 fence/agents/lib/fencing.py.py                  |  3 +++
 fence/agents/lib/fencing_snmp.py.py             |  6 +-----
 9 files changed, 13 insertions(+), 28 deletions(-)

diff --git a/fence/agents/apc_snmp/fence_apc_snmp.py b/fence/agents/apc_snmp/fence_apc_snmp.py
index 2461476..29aafe6 100644
--- a/fence/agents/apc_snmp/fence_apc_snmp.py
+++ b/fence/agents/apc_snmp/fence_apc_snmp.py
@@ -16,7 +16,7 @@ import sys
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
-from fencing_snmp import *
+from fencing_snmp import FencingSnmp
 
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION="APC SNMP fence agent"
@@ -169,11 +169,6 @@ def get_outlets_status(conn, options):
 
 	return result
 
-# Define new options
-def apc_snmp_define_defaults():
-	all_opt["snmp_version"]["default"] = "1"
-	all_opt["community"]["default"] = "private"
-
 # Main agent method
 def main():
 	device_opt = [ "ipaddr", "login", "passwd", "no_login", "no_password", \
@@ -181,8 +176,8 @@ def main():
 
 	atexit.register(atexit_handler)
 
-	snmp_define_defaults ()
-	apc_snmp_define_defaults()
+	all_opt["snmp_version"]["default"] = "1"
+	all_opt["community"]["default"] = "private"
 
 	options = check_input(device_opt, process_input(device_opt))
 
diff --git a/fence/agents/cisco_mds/fence_cisco_mds.py b/fence/agents/cisco_mds/fence_cisco_mds.py
index 6cc189f..84adee2 100644
--- a/fence/agents/cisco_mds/fence_cisco_mds.py
+++ b/fence/agents/cisco_mds/fence_cisco_mds.py
@@ -11,7 +11,7 @@ import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 from fencing import fail_usage
-from fencing_snmp import *
+from fencing_snmp import FencingSnmp
 
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION="Cisco MDS 9xxx SNMP fence agent"
@@ -84,8 +84,6 @@ def main():
 
 	atexit.register(atexit_handler)
 
-	snmp_define_defaults ()
-
 	options = check_input(device_opt, process_input(device_opt))
 
 	docs = { }
diff --git a/fence/agents/eaton_snmp/fence_eaton_snmp.py b/fence/agents/eaton_snmp/fence_eaton_snmp.py
index f519be8..970fd69 100644
--- a/fence/agents/eaton_snmp/fence_eaton_snmp.py
+++ b/fence/agents/eaton_snmp/fence_eaton_snmp.py
@@ -10,7 +10,7 @@ import sys
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
-from fencing_snmp import *
+from fencing_snmp import FencingSnmp
 
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION="Eaton SNMP fence agent"
@@ -204,8 +204,6 @@ def main():
 
 	atexit.register(atexit_handler)
 
-	snmp_define_defaults ()
-
 	all_opt["switch"]["default"] = 1
 	all_opt["power_wait"]["default"] = 2
 	all_opt["snmp_version"]["default"] = "1"
diff --git a/fence/agents/ibmblade/fence_ibmblade.py b/fence/agents/ibmblade/fence_ibmblade.py
index 43bc73e..d1bb065 100644
--- a/fence/agents/ibmblade/fence_ibmblade.py
+++ b/fence/agents/ibmblade/fence_ibmblade.py
@@ -4,7 +4,7 @@ import sys
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
-from fencing_snmp import *
+from fencing_snmp import FencingSnmp
 
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION="IBM Blade SNMP fence agent"
@@ -57,7 +57,6 @@ def main():
 
 	atexit.register(atexit_handler)
 
-	snmp_define_defaults()
 	all_opt["snmp_version"]["default"] = "1"
 
 	options = check_input(device_opt, process_input(device_opt))
diff --git a/fence/agents/ifmib/fence_ifmib.py b/fence/agents/ifmib/fence_ifmib.py
index 350ce71..f8beaa5 100644
--- a/fence/agents/ifmib/fence_ifmib.py
+++ b/fence/agents/ifmib/fence_ifmib.py
@@ -13,7 +13,7 @@ import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
 from fencing import fail_usage
-from fencing_snmp import *
+from fencing_snmp import FencingSnmp
 
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION="IF:MIB SNMP fence agent"
@@ -102,7 +102,6 @@ def main():
 
 	atexit.register(atexit_handler)
 
-	snmp_define_defaults ()
 	all_opt["snmp_version"]["default"] = "2c"
 
 	options = check_input(device_opt, process_input(device_opt))
diff --git a/fence/agents/intelmodular/fence_intelmodular.py b/fence/agents/intelmodular/fence_intelmodular.py
index 320b2db..e9ef43c 100644
--- a/fence/agents/intelmodular/fence_intelmodular.py
+++ b/fence/agents/intelmodular/fence_intelmodular.py
@@ -15,7 +15,7 @@ import sys
 import atexit
 sys.path.append("@FENCEAGENTSLIBDIR@")
 from fencing import *
-from fencing_snmp import *
+from fencing_snmp import FencingSnmp
 
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION="Intel Modular SNMP fence agent"
@@ -68,8 +68,6 @@ def main():
 
 	atexit.register(atexit_handler)
 
-	snmp_define_defaults ()
-
 	options = check_input(device_opt, process_input(device_opt))
 
 	docs = { }
diff --git a/fence/agents/ipdu/fence_ipdu.py b/fence/agents/ipdu/fence_ipdu.py
index 62a2df4..83f1dd4 100644
--- a/fence/agents/ipdu/fence_ipdu.py
+++ b/fence/agents/ipdu/fence_ipdu.py
@@ -9,7 +9,7 @@ import sys
 import atexit
 sys.path.append("/usr/share/fence")
 from fencing import *
-from fencing_snmp import *
+from fencing_snmp import FencingSnmp
 
 #BEGIN_VERSION_GENERATION
 RELEASE_VERSION="IBM iPDU SNMP fence agent"
@@ -133,7 +133,6 @@ def main():
 
 	atexit.register(atexit_handler)
 
-	snmp_define_defaults ()
 	all_opt["snmp_version"]["default"] = "3"
 	all_opt["community"]["default"] = "private"
 	all_opt["switch"]["default"] = "1"
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 3409b60..fe4d9c4 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -643,6 +643,9 @@ def check_input(device_opt, opt):
 		if options.has_key("--ipport"):
 			all_opt["ipport"]["help"] = "-u, --ipport=[port]            " + \
 					"TCP/UDP port to use (default " + options["--ipport"] +")"
+		elif device_opt.count("snmp_version"):
+			all_opt["ipport"]["default"] = "161"
+			all_opt["ipport"]["help"] = "-u, --ipport=[port]            TCP/UDP port to use (default 161)"
 		elif options.has_key("--ssh"):
 			all_opt["ipport"]["default"] = 22
 			all_opt["ipport"]["help"] = "-u, --ipport=[port]            TCP/UDP port to use (default 22)"
diff --git a/fence/agents/lib/fencing_snmp.py.py b/fence/agents/lib/fencing_snmp.py.py
index e65a551..98afd30 100644
--- a/fence/agents/lib/fencing_snmp.py.py
+++ b/fence/agents/lib/fencing_snmp.py.py
@@ -6,7 +6,7 @@ import re, pexpect
 from fencing import *
 from fencing import fail, fail_usage, EC_TIMED_OUT, LOG_MODE_VERBOSE
 
-__all__ = [ 'FencingSnmp', 'snmp_define_defaults' ]
+__all__ = [ 'FencingSnmp' ]
 
 ## do not add code here.
 #BEGIN_VERSION_GENERATION
@@ -15,10 +15,6 @@ REDHAT_COPYRIGHT = ""
 BUILD_DATE = ""
 #END_VERSION_GENERATION
 
-# Fix for RHBZ#527844
-def snmp_define_defaults ():
-	all_opt["ipport"]["default"] = "161"
-
 class FencingSnmp:
 	def __init__(self, options):
 		self.options = options
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Cluster-devel] [PATCH 13/15] [cleanup] Remove unused arguments
  2014-04-02 11:52 [Cluster-devel] [PATCH 01/15] [cleanup] Add missing spaces and fix tab/spaces indentation Marek 'marx' Grac
                   ` (10 preceding siblings ...)
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 12/15] [cleanup] Remove snmp_define_defaults() Marek 'marx' Grac
@ 2014-04-02 11:52 ` Marek 'marx' Grac
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 14/15] [cleanup] Remove transfer script used in transition 3.x->4.x Marek 'marx' Grac
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 15/15] [cleanup] Fix invalid names of variables Marek 'marx' Grac
  13 siblings, 0 replies; 15+ messages in thread
From: Marek 'marx' Grac @ 2014-04-02 11:52 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Arguments 'options' which will be used instead of global variables are left untouched
so that this problem is visible.
---
 fence/agents/apc_snmp/fence_apc_snmp.py     |  6 +++---
 fence/agents/cisco_ucs/fence_cisco_ucs.py   |  5 +++++
 fence/agents/dummy/fence_dummy.py           |  7 +++++++
 fence/agents/eaton_snmp/fence_eaton_snmp.py |  6 +++---
 fence/agents/eps/fence_eps.py               |  2 ++
 fence/agents/rhevm/fence_rhevm.py           |  4 ++++
 fence/agents/vmware/fence_vmware.py         | 12 ++++++++----
 7 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/fence/agents/apc_snmp/fence_apc_snmp.py b/fence/agents/apc_snmp/fence_apc_snmp.py
index 29aafe6..d91e9e9 100644
--- a/fence/agents/apc_snmp/fence_apc_snmp.py
+++ b/fence/agents/apc_snmp/fence_apc_snmp.py
@@ -87,7 +87,7 @@ class ApcMS:
 	has_switches = False
 
 ### FUNCTIONS ###
-def apc_set_device(conn, options):
+def apc_set_device(conn):
 	global device
 
 	agents_dir = {'.1.3.6.1.4.1.318.1.3.4.5':ApcRPDU,
@@ -109,7 +109,7 @@ def apc_resolv_port_id(conn, options):
 	global port_id, switch_id
 
 	if (device == None):
-		apc_set_device(conn, options)
+		apc_set_device(conn)
 
 	# Now we resolv port_id/switch_id
 	if ((options["--plug"].isdigit()) and ((not device.has_switches) or (options["--switch"].isdigit()))):
@@ -154,7 +154,7 @@ def get_outlets_status(conn, options):
 	result = {}
 
 	if (device == None):
-		apc_set_device(conn, options)
+		apc_set_device(conn)
 
 	res_ports = conn.walk(device.outlet_table_oid, 30)
 
diff --git a/fence/agents/cisco_ucs/fence_cisco_ucs.py b/fence/agents/cisco_ucs/fence_cisco_ucs.py
index 95dd2b4..d073af6 100644
--- a/fence/agents/cisco_ucs/fence_cisco_ucs.py
+++ b/fence/agents/cisco_ucs/fence_cisco_ucs.py
@@ -20,6 +20,8 @@ RE_GET_DN = re.compile(" dn=\"(.*?)\"", re.IGNORECASE)
 RE_GET_DESC = re.compile(" descr=\"(.*?)\"", re.IGNORECASE)
 
 def get_power_status(conn, options):
+	del conn
+
 	res = send_command(options, "<configResolveDn cookie=\"" + options["cookie"] +
 			"\" inHierarchical=\"false\" dn=\"org-root" + options["--suborg"] + "/ls-" +
 			options["--plug"] + "/power\"/>", int(options["--shell-timeout"]))
@@ -36,6 +38,8 @@ def get_power_status(conn, options):
 		return "off"
 
 def set_power_status(conn, options):
+	del conn
+
 	action = {
 		'on' : "up",
 		'off' : "down"
@@ -50,6 +54,7 @@ def set_power_status(conn, options):
 	return
 
 def get_list(conn, options):
+	del conn
 	outlets = { }
 
 	try:
diff --git a/fence/agents/dummy/fence_dummy.py b/fence/agents/dummy/fence_dummy.py
index e7c235a..f3b0ec0 100644
--- a/fence/agents/dummy/fence_dummy.py
+++ b/fence/agents/dummy/fence_dummy.py
@@ -16,6 +16,8 @@ BUILD_DATE=""
 plug_status = "on"
 
 def get_power_status_file(conn, options):
+	del conn
+
 	try:
 		status_file = open(options["--status-file"], 'r')
 	except:
@@ -27,6 +29,8 @@ def get_power_status_file(conn, options):
 	return status.lower()
 
 def set_power_status_file(conn, options):
+	del conn
+
 	if not (options["--action"] in [ "on", "off" ]):
 		return
 
@@ -44,12 +48,15 @@ def get_power_status_fail(conn, options):
 
 def set_power_status_fail(conn, options):
 	global plug_status
+	del conn
 
 	plug_status = "unknown"
 	if options["--action"] == "on":
 		plug_status = "off"
 
 def get_outlets_fail(conn, options):
+	del conn
+
 	result = {}
 	global plug_status
 
diff --git a/fence/agents/eaton_snmp/fence_eaton_snmp.py b/fence/agents/eaton_snmp/fence_eaton_snmp.py
index 970fd69..9688516 100644
--- a/fence/agents/eaton_snmp/fence_eaton_snmp.py
+++ b/fence/agents/eaton_snmp/fence_eaton_snmp.py
@@ -65,7 +65,7 @@ class EatonSwitchedePDU:
 	has_switches = False
 
 ### FUNCTIONS ###
-def eaton_set_device(conn, options):
+def eaton_set_device(conn):
 	global device
 
 	agents_dir = {'.1.3.6.1.4.1.534.6.6.6':EatonManagedePDU,
@@ -86,7 +86,7 @@ def eaton_resolv_port_id(conn, options):
 	global port_id, switch_id
 
 	if (device==None):
-		eaton_set_device(conn, options)
+		eaton_set_device(conn)
 
 	# Restore the increment, that was removed in main for ePDU Managed
 	if (device.ident_str == "Eaton Switched ePDU"):
@@ -165,7 +165,7 @@ def get_outlets_status(conn, options):
 	result = {}
 
 	if (device==None):
-		eaton_set_device(conn, options)
+		eaton_set_device(conn)
 
 	res_ports = conn.walk(device.outlet_table_oid, 30)
 
diff --git a/fence/agents/eps/fence_eps.py b/fence/agents/eps/fence_eps.py
index f8230e5..65b49db 100644
--- a/fence/agents/eps/fence_eps.py
+++ b/fence/agents/eps/fence_eps.py
@@ -68,6 +68,7 @@ def eps_run_command(options, params):
 	return result
 
 def get_power_status(conn, options):
+	del conn
 	ret_val = eps_run_command(options,"")
 
 	result = {}
@@ -84,6 +85,7 @@ def get_power_status(conn, options):
 		return result
 
 def set_power_status(conn, options):
+	del conn
 	eps_run_command(options, "P%s=%s"%(options["--plug"], (options["--action"]=="on" and "1" or "0")))
 
 # Define new option
diff --git a/fence/agents/rhevm/fence_rhevm.py b/fence/agents/rhevm/fence_rhevm.py
index 8c28b2d..2529801 100644
--- a/fence/agents/rhevm/fence_rhevm.py
+++ b/fence/agents/rhevm/fence_rhevm.py
@@ -19,6 +19,8 @@ RE_STATUS = re.compile("<state>(.*?)</state>", re.IGNORECASE)
 RE_GET_NAME = re.compile("<name>(.*?)</name>", re.IGNORECASE)
 
 def get_power_status(conn, options):
+	del conn
+
 	### Obtain real ID from name
 	res = send_command(options, "vms/?search=name%3D" + options["--plug"])
 
@@ -44,6 +46,7 @@ def get_power_status(conn, options):
 		return "on"
 
 def set_power_status(conn, options):
+	del conn
 	action = {
 		'on' : "start",
 		'off' : "stop"
@@ -53,6 +56,7 @@ def set_power_status(conn, options):
 	send_command(options, url, "POST")
 
 def get_list(conn, options):
+	del conn
 	outlets = { }
 
 	try:
diff --git a/fence/agents/vmware/fence_vmware.py b/fence/agents/vmware/fence_vmware.py
index 3a7bc61..ee65186 100644
--- a/fence/agents/vmware/fence_vmware.py
+++ b/fence/agents/vmware/fence_vmware.py
@@ -168,7 +168,7 @@ def vmware_run_command(options, add_login_params, additional_params, additional_
 
 # Get outlet list with status as hash table. If you will use add_vm_name, only VM with vmname is
 # returned. This is used in get_status function
-def vmware_get_outlets_vi(conn, options, add_vm_name):
+def vmware_get_outlets_vi(options, add_vm_name):
 	outlets = {}
 
 	if (add_vm_name):
@@ -195,7 +195,7 @@ def vmware_get_outlets_vi(conn, options, add_vm_name):
 	return outlets
 
 # Get outlet list with status as hash table.
-def vmware_get_outlets_vix(conn, options):
+def vmware_get_outlets_vix(options):
 	outlets = {}
 
 	running_machines = vmware_run_command(options, True, "list", 0)
@@ -214,10 +214,12 @@ def vmware_get_outlets_vix(conn, options):
 	return outlets
 
 def get_outlets_status(conn, options):
+	del conn
+
 	if (vmware_internal_type==VMWARE_TYPE_ESX):
-		return vmware_get_outlets_vi(conn, options, False)
+		return vmware_get_outlets_vi(options, False)
 	if ((vmware_internal_type==VMWARE_TYPE_SERVER1) or (vmware_internal_type==VMWARE_TYPE_SERVER2)):
-		return vmware_get_outlets_vix(conn, options)
+		return vmware_get_outlets_vix(options)
 
 def get_power_status(conn, options):
 	if (vmware_internal_type==VMWARE_TYPE_ESX):
@@ -234,6 +236,8 @@ def get_power_status(conn, options):
 		return ((options["--plug"] in outlets) and "on" or "off")
 
 def set_power_status(conn, options):
+	del conn
+
 	if (vmware_internal_type==VMWARE_TYPE_ESX):
 		additional_params = "--operation %s --vmname '%s'" % \
 				((options["--action"]=="on" and "on" or "off"), quote_for_run(options["--plug"]))
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Cluster-devel] [PATCH 14/15] [cleanup] Remove transfer script used in transition 3.x->4.x
  2014-04-02 11:52 [Cluster-devel] [PATCH 01/15] [cleanup] Add missing spaces and fix tab/spaces indentation Marek 'marx' Grac
                   ` (11 preceding siblings ...)
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 13/15] [cleanup] Remove unused arguments Marek 'marx' Grac
@ 2014-04-02 11:52 ` Marek 'marx' Grac
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 15/15] [cleanup] Fix invalid names of variables Marek 'marx' Grac
  13 siblings, 0 replies; 15+ messages in thread
From: Marek 'marx' Grac @ 2014-04-02 11:52 UTC (permalink / raw)
  To: cluster-devel.redhat.com

---
 fence/agents/lib/transfer.py | 16 ----------------
 1 file changed, 16 deletions(-)
 delete mode 100755 fence/agents/lib/transfer.py

diff --git a/fence/agents/lib/transfer.py b/fence/agents/lib/transfer.py
deleted file mode 100755
index b7a39db..0000000
--- a/fence/agents/lib/transfer.py
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/python -tt
-
-from fencing import *
-
-def main():
-	for key in all_opt.keys():
-		if all_opt[key].has_key("getopt") and all_opt[key].has_key("longopt"):
-			print "s/options\[\"-" + all_opt[key]["getopt"].rstrip(":") + "\"\]/options[\"--" + \
-				all_opt[key]["longopt"] + "\"]/g"
-			print "s/options.has_key(\"-" + all_opt[key]["getopt"].rstrip(":") + "\")/options.has_key(" + \
-				"\"--" + all_opt[key]["longopt"] + "\")/g"
-
-
-
-if __name__ == "__main__":
-	main()
\ No newline at end of file
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Cluster-devel] [PATCH 15/15] [cleanup] Fix invalid names of variables
  2014-04-02 11:52 [Cluster-devel] [PATCH 01/15] [cleanup] Add missing spaces and fix tab/spaces indentation Marek 'marx' Grac
                   ` (12 preceding siblings ...)
  2014-04-02 11:52 ` [Cluster-devel] [PATCH 14/15] [cleanup] Remove transfer script used in transition 3.x->4.x Marek 'marx' Grac
@ 2014-04-02 11:52 ` Marek 'marx' Grac
  13 siblings, 0 replies; 15+ messages in thread
From: Marek 'marx' Grac @ 2014-04-02 11:52 UTC (permalink / raw)
  To: cluster-devel.redhat.com

---
 fence/agents/apc/fence_apc.py             |  8 ++++----
 fence/agents/brocade/fence_brocade.py     |  4 ++--
 fence/agents/cisco_ucs/fence_cisco_ucs.py | 26 +++++++++++++-------------
 fence/agents/lib/check_used_options.py    |  8 ++++----
 fence/agents/lib/fencing.py.py            | 14 +++++++-------
 fence/agents/rhevm/fence_rhevm.py         | 26 +++++++++++++-------------
 fence/agents/xenapi/fence_xenapi.py       |  4 ++--
 7 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index 1e86c07..f744583 100644
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -74,8 +74,8 @@ def get_power_status(conn, options):
 				["Press <ENTER>" ] + options["--command-prompt"], int(options["--shell-timeout"]))
 		lines = conn.before.split("\n")
 		show_re = re.compile(r'(^|\x0D)\s*(\d+)- (.*?)\s+(ON|OFF)\s*')
-		for x in lines:
-			res = show_re.search(x)
+		for line in lines:
+			res = show_re.search(line)
 			if (res != None):
 				outlets[res.group(2)] = (res.group(3), res.group(4))
 		conn.send_eol("")
@@ -187,8 +187,8 @@ def get_power_status5(conn, options):
 
 	show_re = re.compile(r'^\s*(\d+): (.*): (On|Off)\s*$', re.IGNORECASE)
 
-	for x in lines:
-		res = show_re.search(x)
+	for line in lines:
+		res = show_re.search(line)
 		if (res != None):
 			outlets[res.group(1)] = (res.group(2), res.group(3))
 
diff --git a/fence/agents/brocade/fence_brocade.py b/fence/agents/brocade/fence_brocade.py
index a60355d..35082ee 100644
--- a/fence/agents/brocade/fence_brocade.py
+++ b/fence/agents/brocade/fence_brocade.py
@@ -20,8 +20,8 @@ def get_power_status(conn, options):
 	show_re = re.compile(r'^\s*Persistent Disable\s*(ON|OFF)\s*$', re.IGNORECASE)
 	lines = conn.before.split("\n")
 
-	for x in lines:
-		res = show_re.search(x)
+	for line in lines:
+		res = show_re.search(line)
 		if (res != None):
 			# We queried if it is disabled, so we have to negate answer
 			if res.group(1) == "ON":
diff --git a/fence/agents/cisco_ucs/fence_cisco_ucs.py b/fence/agents/cisco_ucs/fence_cisco_ucs.py
index d073af6..ee1ae11 100644
--- a/fence/agents/cisco_ucs/fence_cisco_ucs.py
+++ b/fence/agents/cisco_ucs/fence_cisco_ucs.py
@@ -63,9 +63,9 @@ def get_list(conn, options):
 
 		lines = res.split("<lsServer ")
 		for i in range(1, len(lines)):
-			dn = RE_GET_DN.search(lines[i]).group(1)
+			node_name = RE_GET_DN.search(lines[i]).group(1)
 			desc = RE_GET_DESC.search(lines[i]).group(1)
-			outlets[dn] = (desc, None)
+			outlets[node_name] = (desc, None)
 	except AttributeError:
 		return { }
 	except IndexError:
@@ -83,17 +83,17 @@ def send_command(opt, command, timeout):
 	url += "//" + opt["--ip"] + ":" + str(opt["--ipport"]) + "/nuova"
 
 	## send command through pycurl
-	c = pycurl.Curl()
-	b = StringIO.StringIO()
-	c.setopt(pycurl.URL, url)
-	c.setopt(pycurl.HTTPHEADER, [ "Content-type: text/xml" ])
-	c.setopt(pycurl.POSTFIELDS, command)
-	c.setopt(pycurl.WRITEFUNCTION, b.write)
-	c.setopt(pycurl.TIMEOUT, timeout)
-	c.setopt(pycurl.SSL_VERIFYPEER, 0)
-	c.setopt(pycurl.SSL_VERIFYHOST, 0)
-	c.perform()
-	result = b.getvalue()
+	conn = pycurl.Curl()
+	web_buffer = StringIO.StringIO()
+	conn.setopt(pycurl.URL, url)
+	conn.setopt(pycurl.HTTPHEADER, [ "Content-type: text/xml" ])
+	conn.setopt(pycurl.POSTFIELDS, command)
+	conn.setopt(pycurl.WRITEFUNCTION, web_buffer.write)
+	conn.setopt(pycurl.TIMEOUT, timeout)
+	conn.setopt(pycurl.SSL_VERIFYPEER, 0)
+	conn.setopt(pycurl.SSL_VERIFYHOST, 0)
+	conn.perform()
+	result = web_buffer.getvalue()
 
 	if opt["log"] >= LOG_MODE_VERBOSE:
 		opt["debug_fh"].write(command + "\n")
diff --git a/fence/agents/lib/check_used_options.py b/fence/agents/lib/check_used_options.py
index ce74fa9..7f821b1 100755
--- a/fence/agents/lib/check_used_options.py
+++ b/fence/agents/lib/check_used_options.py
@@ -46,13 +46,13 @@ def main():
 	for line in agent_file:
 		counter += 1
 
-		for x in option_use_re.findall(line):
-			if not available.has_key(x):
+		for option in option_use_re.findall(line):
+			if not available.has_key(option):
 				print "ERROR on line %d in %s: option %s is not defined" % (counter, agent, option_use_re.search(line).group(1))
 				without_errors = False
 
-		for x in option_has_re.findall(line):
-			if not available.has_key(x):
+		for option in option_has_re.findall(line):
+			if not available.has_key(option):
 				print "ERROR on line %d in %s: option %s is not defined" % (counter, agent, option_has_re.search(line).group(1))
 				without_errors = False
 
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index fe4d9c4..013ae68 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -404,11 +404,11 @@ def atexit_handler():
 		sys.exit(EC_GENERIC_ERROR)
 
 def add_dependency_options(options):
-	## Add options which are available for every fence agent
+	## Add also options which are available for every fence agent
 	added_opt = []
-	for x in options + ["default"]:
-		if DEPENDENCY_OPT.has_key(x):
-			added_opt.extend([y for y in DEPENDENCY_OPT[x] if options.count(y) == 0])
+	for opt in options + ["default"]:
+		if DEPENDENCY_OPT.has_key(opt):
+			added_opt.extend([y for y in DEPENDENCY_OPT[opt] if options.count(y) == 0])
 	return added_opt
 
 def fail_usage(message = ""):
@@ -860,10 +860,10 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
 				((options["--action"] == "monitor") and 1 == options["device_opt"].count("port")):
 			outlets = get_outlet_list(tn, options)
 			## keys can be numbers (port numbers) or strings (names of VM)
-			for o in outlets.keys():
-				(alias, status) = outlets[o]
+			for outlet_id in outlets.keys():
+				(alias, status) = outlets[outlet_id]
 				if options["--action"] != "monitor":
-					print o + options["--separator"] + alias
+					print outled_id + options["--separator"] + alias
 			return
 
 		status = get_multi_power_fn(tn, options, get_power_fn)
diff --git a/fence/agents/rhevm/fence_rhevm.py b/fence/agents/rhevm/fence_rhevm.py
index 2529801..b1c97e4 100644
--- a/fence/agents/rhevm/fence_rhevm.py
+++ b/fence/agents/rhevm/fence_rhevm.py
@@ -83,22 +83,22 @@ def send_command(opt, command, method = "GET"):
 	url += "//" + opt["--ip"] + ":" + str(opt["--ipport"]) + "/api/" + command
 
 	## send command through pycurl
-	c = pycurl.Curl()
-	b = StringIO.StringIO()
-	c.setopt(pycurl.URL, url)
-	c.setopt(pycurl.HTTPHEADER, [ "Content-type: application/xml", "Accept: application/xml" ])
-	c.setopt(pycurl.HTTPAUTH, pycurl.HTTPAUTH_BASIC)
-	c.setopt(pycurl.USERPWD, opt["--username"] + ":" + opt["--password"])
-	c.setopt(pycurl.TIMEOUT, int(opt["--shell-timeout"]))
-	c.setopt(pycurl.SSL_VERIFYPEER, 0)
-	c.setopt(pycurl.SSL_VERIFYHOST, 0)
+	conn = pycurl.Curl()
+	web_buffer = StringIO.StringIO()
+	conn.setopt(pycurl.URL, url)
+	conn.setopt(pycurl.HTTPHEADER, [ "Content-type: application/xml", "Accept: application/xml" ])
+	conn.setopt(pycurl.HTTPAUTH, pycurl.HTTPAUTH_BASIC)
+	conn.setopt(pycurl.USERPWD, opt["--username"] + ":" + opt["--password"])
+	conn.setopt(pycurl.TIMEOUT, int(opt["--shell-timeout"]))
+	conn.setopt(pycurl.SSL_VERIFYPEER, 0)
+	conn.setopt(pycurl.SSL_VERIFYHOST, 0)
 
 	if (method == "POST"):
-		c.setopt(pycurl.POSTFIELDS, "<action />")
+		conn.setopt(pycurl.POSTFIELDS, "<action />")
 
-	c.setopt(pycurl.WRITEFUNCTION, b.write)
-	c.perform()
-	result = b.getvalue()
+	conn.setopt(pycurl.WRITEFUNCTION, web_buffer.write)
+	conn.perform()
+	result = web_buffer.getvalue()
 
 	if opt["log"] >= LOG_MODE_VERBOSE:
 		opt["debug_fh"].write(command + "\n")
diff --git a/fence/agents/xenapi/fence_xenapi.py b/fence/agents/xenapi/fence_xenapi.py
index 3b6454c..2a52c98 100644
--- a/fence/agents/xenapi/fence_xenapi.py
+++ b/fence/agents/xenapi/fence_xenapi.py
@@ -217,10 +217,10 @@ the status of virtual machines running on the host."
 	docs["vendorurl"] = "http://www.xenproject.org"
 	show_docs(options, docs)
 
-	xenSession = connect_and_login(options)
+	xen_session = connect_and_login(options)
 
 	# Operate the fencing device
-	result = fence_action(xenSession, options, set_power_fn, get_power_fn, get_outlet_list)
+	result = fence_action(xen_session, options, set_power_fn, get_power_fn, get_outlet_list)
 
 	sys.exit(result)
 
-- 
1.9.0



^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2014-04-02 11:52 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-02 11:52 [Cluster-devel] [PATCH 01/15] [cleanup] Add missing spaces and fix tab/spaces indentation Marek 'marx' Grac
2014-04-02 11:52 ` [Cluster-devel] [PATCH 02/15] [cleanup] Proper import of atexit Marek 'marx' Grac
2014-04-02 11:52 ` [Cluster-devel] [PATCH 03/15] [cleanup] Remove unused variables Marek 'marx' Grac
2014-04-02 11:52 ` [Cluster-devel] [PATCH 04/15] [cleanup] Split lines that were too long Marek 'marx' Grac
2014-04-02 11:52 ` [Cluster-devel] [PATCH 05/15] [cleanup] Remove unused dependencies Marek 'marx' Grac
2014-04-02 11:52 ` [Cluster-devel] [PATCH 06/15] [cleanup] Remove problems with redefining variables/functions Marek 'marx' Grac
2014-04-02 11:52 ` [Cluster-devel] [PATCH 07/15] [cleanup] Only symbols that should be used are exported from fencing library Marek 'marx' Grac
2014-04-02 11:52 ` [Cluster-devel] [PATCH 08/15] [cleanup] Mark raw strings with r"" Marek 'marx' Grac
2014-04-02 11:52 ` [Cluster-devel] [PATCH 09/15] [cleanup] Only symbols that should be used are exported from fencing_snmp library Marek 'marx' Grac
2014-04-02 11:52 ` [Cluster-devel] [PATCH 10/15] [cleanup] Errors when encountering mixed space/tab in python Marek 'marx' Grac
2014-04-02 11:52 ` [Cluster-devel] [PATCH 11/15] [cleanup] Mark raw strings with r"" in fence_virsh Marek 'marx' Grac
2014-04-02 11:52 ` [Cluster-devel] [PATCH 12/15] [cleanup] Remove snmp_define_defaults() Marek 'marx' Grac
2014-04-02 11:52 ` [Cluster-devel] [PATCH 13/15] [cleanup] Remove unused arguments Marek 'marx' Grac
2014-04-02 11:52 ` [Cluster-devel] [PATCH 14/15] [cleanup] Remove transfer script used in transition 3.x->4.x Marek 'marx' Grac
2014-04-02 11:52 ` [Cluster-devel] [PATCH 15/15] [cleanup] Fix invalid names of variables Marek 'marx' Grac

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).