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