[Cluster-devel] [PATCH 01/15] [cleanup] Add missing spaces and fix tab/spaces indentation
Marek 'marx' Grac
mgrac at redhat.com
Wed Apr 2 11:52:09 UTC 2014
---
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
More information about the Cluster-devel
mailing list