Gitweb:
http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=db1d73...
Commit: db1d7376180a0d4329a8ab5fe78690b0c77fa2c3
Parent: 80bae803aad75516cfe77cc90a7a37749d9175b7
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Oct 29 12:58:03 2012 +0100
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Nov 5 14:45:17 2012 +0100
code cleanup: Fix warnings according to pylint
* use of possibly unitialized values
* redefining built-in functions
* unused block of code
---
fence/agents/ibmblade/fence_ibmblade.py | 2 --
fence/agents/lib/fencing_snmp.py.py | 10 +++++-----
fence/agents/vmware_soap/fence_vmware_soap.py | 1 -
fence/agents/wti/fence_wti.py | 5 +++++
fence/agents/xenapi/fence_xenapi.py | 4 ----
5 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/fence/agents/ibmblade/fence_ibmblade.py
b/fence/agents/ibmblade/fence_ibmblade.py
index 16a18df..f9ee955 100644
--- a/fence/agents/ibmblade/fence_ibmblade.py
+++ b/fence/agents/ibmblade/fence_ibmblade.py
@@ -50,8 +50,6 @@ def get_outlets_status(conn, options):
# Main agent method
def main():
- global port_oid
-
device_opt = [ "ipaddr", "login", "passwd",
"passwd_script",
"test", "port", "separator", "no_login",
"no_password",
"snmp_version", "community", "snmp_auth_prot",
"snmp_sec_level",
diff --git a/fence/agents/lib/fencing_snmp.py.py b/fence/agents/lib/fencing_snmp.py.py
index f478c53..e4c4636 100644
--- a/fence/agents/lib/fencing_snmp.py.py
+++ b/fence/agents/lib/fencing_snmp.py.py
@@ -26,8 +26,8 @@ class FencingSnmp:
if self.options["log"] >= LOG_MODE_VERBOSE:
self.options["debug_fh"].write(message+"\n")
- def quote_for_run(self, str):
- return ''.join(map(lambda x:x==r"'" and
"'\\''" or x, str))
+ def quote_for_run(self, string):
+ return ''.join(map(lambda x:x==r"'" and
"'\\''" or x, string))
def complete_missed_params(self):
mapping = [
@@ -112,14 +112,14 @@ class FencingSnmp:
def set(self, oid, value, additional_timemout=0):
mapping = ((int, 'i'), (str, 's'))
- type = ''
+ type_of_value = ''
for item in mapping:
if (isinstance(value, item[0])):
- type = item[1]
+ type_of_value = item[1]
break
- cmd = "%s '%s' %s '%s'"%
(self.prepare_cmd("snmpset"), self.quote_for_run(oid), type,
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/vmware_soap/fence_vmware_soap.py
b/fence/agents/vmware_soap/fence_vmware_soap.py
index 41da8c0..2710603 100644
--- a/fence/agents/vmware_soap/fence_vmware_soap.py
+++ b/fence/agents/vmware_soap/fence_vmware_soap.py
@@ -139,7 +139,6 @@ def get_power_status(conn, options):
return "on"
else:
return "off"
- return status
except KeyError, ex:
fail(EC_STATUS)
diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py
index 555fb98..1f353be 100644
--- a/fence/agents/wti/fence_wti.py
+++ b/fence/agents/wti/fence_wti.py
@@ -47,7 +47,12 @@ def get_power_status(conn, options):
fail(EC_TIMED_OUT)
plug_section = 0
+ plug_index = -1
+ name_index = -1
+ 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("|")]
diff --git a/fence/agents/xenapi/fence_xenapi.py b/fence/agents/xenapi/fence_xenapi.py
index f583ea5..599f7a5 100644
--- a/fence/agents/xenapi/fence_xenapi.py
+++ b/fence/agents/xenapi/fence_xenapi.py
@@ -78,10 +78,6 @@ 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["-o"].lower()
- if options.has_key("-v"):
- verbose = True
- else:
- verbose = False
try:
# Get a reference to the vm specified in the UUID or vm_name/port parameter