From: Marek 'marx' Grac <mgrac@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 03/15] [cleanup] Remove unused variables
Date: Wed, 2 Apr 2014 13:52:11 +0200 [thread overview]
Message-ID: <1396439543-29533-3-git-send-email-mgrac@redhat.com> (raw)
In-Reply-To: <1396439543-29533-1-git-send-email-mgrac@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
next prev parent reply other threads:[~2014-04-02 11:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1396439543-29533-3-git-send-email-mgrac@redhat.com \
--to=mgrac@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).