Gitweb:
http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=7c0dc5...
Commit: 7c0dc5c4ac9788ee682178e7c84ccc91524cf482
Parent: 3ae766f51be97e2be3af041e6d023c2cab229a2b
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Wed Apr 2 13:37:13 2014 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Wed Apr 9 16:22:15 2014 +0200
[cleanup] Remove unused variables
---
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 | 4 ++--
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, 23 insertions(+), 27 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 f7d48a2..a1cb2a5 100644
--- a/fence/agents/cisco_ucs/fence_cisco_ucs.py
+++ b/fence/agents/cisco_ucs/fence_cisco_ucs.py
@@ -41,7 +41,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 0923e96..4651b3a 100644
--- a/fence/agents/eps/fence_eps.py
+++ b/fence/agents/eps/fence_eps.py
@@ -78,7 +78,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 c9a86f4..645fe24 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -466,7 +466,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"] +
"\">"
@@ -921,7 +921,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
logging.error("%s\n", 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 720be10..dac7f9c 100644
--- a/fence/agents/ovh/fence_ovh.py
+++ b/fence/agents/ovh/fence_ovh.py
@@ -71,8 +71,8 @@ def soap_login(options):
try:
soap = Client(url, doctor=d)
session = soap.service.login(options["--username"],
options["--password"], 'en', 0)
- except Exception, ex:
- fail(EC_LOGIN_DENIED)
+ except Exception:
+ fail(EC_LOGIN_DENIED)
options["session"] = session
return soap
diff --git a/fence/agents/rhevm/fence_rhevm.py b/fence/agents/rhevm/fence_rhevm.py
index 867660d..f3ecaca 100644
--- a/fence/agents/rhevm/fence_rhevm.py
+++ b/fence/agents/rhevm/fence_rhevm.py
@@ -50,7 +50,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