From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek 'marx' Grac Date: Wed, 2 Apr 2014 13:52:11 +0200 Subject: [Cluster-devel] [PATCH 03/15] [cleanup] Remove unused variables In-Reply-To: <1396439543-29533-1-git-send-email-mgrac@redhat.com> References: <1396439543-29533-1-git-send-email-mgrac@redhat.com> Message-ID: <1396439543-29533-3-git-send-email-mgrac@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit --- 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, \ "" + \ "" + \ "" + \ 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 "" + docs["vendorurl"] + "" print "" - for option, _value in sorted_list: + for option, _ in sorted_list: if all_opt[option].has_key("shortdesc"): print "\t" @@ -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