cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Marek 'marx' Grac <mgrac@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 13/15] [cleanup] Remove unused arguments
Date: Wed,  2 Apr 2014 13:52:21 +0200	[thread overview]
Message-ID: <1396439543-29533-13-git-send-email-mgrac@redhat.com> (raw)
In-Reply-To: <1396439543-29533-1-git-send-email-mgrac@redhat.com>

Arguments 'options' which will be used instead of global variables are left untouched
so that this problem is visible.
---
 fence/agents/apc_snmp/fence_apc_snmp.py     |  6 +++---
 fence/agents/cisco_ucs/fence_cisco_ucs.py   |  5 +++++
 fence/agents/dummy/fence_dummy.py           |  7 +++++++
 fence/agents/eaton_snmp/fence_eaton_snmp.py |  6 +++---
 fence/agents/eps/fence_eps.py               |  2 ++
 fence/agents/rhevm/fence_rhevm.py           |  4 ++++
 fence/agents/vmware/fence_vmware.py         | 12 ++++++++----
 7 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/fence/agents/apc_snmp/fence_apc_snmp.py b/fence/agents/apc_snmp/fence_apc_snmp.py
index 29aafe6..d91e9e9 100644
--- a/fence/agents/apc_snmp/fence_apc_snmp.py
+++ b/fence/agents/apc_snmp/fence_apc_snmp.py
@@ -87,7 +87,7 @@ class ApcMS:
 	has_switches = False
 
 ### FUNCTIONS ###
-def apc_set_device(conn, options):
+def apc_set_device(conn):
 	global device
 
 	agents_dir = {'.1.3.6.1.4.1.318.1.3.4.5':ApcRPDU,
@@ -109,7 +109,7 @@ def apc_resolv_port_id(conn, options):
 	global port_id, switch_id
 
 	if (device == None):
-		apc_set_device(conn, options)
+		apc_set_device(conn)
 
 	# Now we resolv port_id/switch_id
 	if ((options["--plug"].isdigit()) and ((not device.has_switches) or (options["--switch"].isdigit()))):
@@ -154,7 +154,7 @@ def get_outlets_status(conn, options):
 	result = {}
 
 	if (device == None):
-		apc_set_device(conn, options)
+		apc_set_device(conn)
 
 	res_ports = conn.walk(device.outlet_table_oid, 30)
 
diff --git a/fence/agents/cisco_ucs/fence_cisco_ucs.py b/fence/agents/cisco_ucs/fence_cisco_ucs.py
index 95dd2b4..d073af6 100644
--- a/fence/agents/cisco_ucs/fence_cisco_ucs.py
+++ b/fence/agents/cisco_ucs/fence_cisco_ucs.py
@@ -20,6 +20,8 @@ RE_GET_DN = re.compile(" dn=\"(.*?)\"", re.IGNORECASE)
 RE_GET_DESC = re.compile(" descr=\"(.*?)\"", re.IGNORECASE)
 
 def get_power_status(conn, options):
+	del conn
+
 	res = send_command(options, "<configResolveDn cookie=\"" + options["cookie"] +
 			"\" inHierarchical=\"false\" dn=\"org-root" + options["--suborg"] + "/ls-" +
 			options["--plug"] + "/power\"/>", int(options["--shell-timeout"]))
@@ -36,6 +38,8 @@ def get_power_status(conn, options):
 		return "off"
 
 def set_power_status(conn, options):
+	del conn
+
 	action = {
 		'on' : "up",
 		'off' : "down"
@@ -50,6 +54,7 @@ def set_power_status(conn, options):
 	return
 
 def get_list(conn, options):
+	del conn
 	outlets = { }
 
 	try:
diff --git a/fence/agents/dummy/fence_dummy.py b/fence/agents/dummy/fence_dummy.py
index e7c235a..f3b0ec0 100644
--- a/fence/agents/dummy/fence_dummy.py
+++ b/fence/agents/dummy/fence_dummy.py
@@ -16,6 +16,8 @@ BUILD_DATE=""
 plug_status = "on"
 
 def get_power_status_file(conn, options):
+	del conn
+
 	try:
 		status_file = open(options["--status-file"], 'r')
 	except:
@@ -27,6 +29,8 @@ def get_power_status_file(conn, options):
 	return status.lower()
 
 def set_power_status_file(conn, options):
+	del conn
+
 	if not (options["--action"] in [ "on", "off" ]):
 		return
 
@@ -44,12 +48,15 @@ def get_power_status_fail(conn, options):
 
 def set_power_status_fail(conn, options):
 	global plug_status
+	del conn
 
 	plug_status = "unknown"
 	if options["--action"] == "on":
 		plug_status = "off"
 
 def get_outlets_fail(conn, options):
+	del conn
+
 	result = {}
 	global plug_status
 
diff --git a/fence/agents/eaton_snmp/fence_eaton_snmp.py b/fence/agents/eaton_snmp/fence_eaton_snmp.py
index 970fd69..9688516 100644
--- a/fence/agents/eaton_snmp/fence_eaton_snmp.py
+++ b/fence/agents/eaton_snmp/fence_eaton_snmp.py
@@ -65,7 +65,7 @@ class EatonSwitchedePDU:
 	has_switches = False
 
 ### FUNCTIONS ###
-def eaton_set_device(conn, options):
+def eaton_set_device(conn):
 	global device
 
 	agents_dir = {'.1.3.6.1.4.1.534.6.6.6':EatonManagedePDU,
@@ -86,7 +86,7 @@ def eaton_resolv_port_id(conn, options):
 	global port_id, switch_id
 
 	if (device==None):
-		eaton_set_device(conn, options)
+		eaton_set_device(conn)
 
 	# Restore the increment, that was removed in main for ePDU Managed
 	if (device.ident_str == "Eaton Switched ePDU"):
@@ -165,7 +165,7 @@ def get_outlets_status(conn, options):
 	result = {}
 
 	if (device==None):
-		eaton_set_device(conn, options)
+		eaton_set_device(conn)
 
 	res_ports = conn.walk(device.outlet_table_oid, 30)
 
diff --git a/fence/agents/eps/fence_eps.py b/fence/agents/eps/fence_eps.py
index f8230e5..65b49db 100644
--- a/fence/agents/eps/fence_eps.py
+++ b/fence/agents/eps/fence_eps.py
@@ -68,6 +68,7 @@ def eps_run_command(options, params):
 	return result
 
 def get_power_status(conn, options):
+	del conn
 	ret_val = eps_run_command(options,"")
 
 	result = {}
@@ -84,6 +85,7 @@ def get_power_status(conn, options):
 		return result
 
 def set_power_status(conn, options):
+	del conn
 	eps_run_command(options, "P%s=%s"%(options["--plug"], (options["--action"]=="on" and "1" or "0")))
 
 # Define new option
diff --git a/fence/agents/rhevm/fence_rhevm.py b/fence/agents/rhevm/fence_rhevm.py
index 8c28b2d..2529801 100644
--- a/fence/agents/rhevm/fence_rhevm.py
+++ b/fence/agents/rhevm/fence_rhevm.py
@@ -19,6 +19,8 @@ RE_STATUS = re.compile("<state>(.*?)</state>", re.IGNORECASE)
 RE_GET_NAME = re.compile("<name>(.*?)</name>", re.IGNORECASE)
 
 def get_power_status(conn, options):
+	del conn
+
 	### Obtain real ID from name
 	res = send_command(options, "vms/?search=name%3D" + options["--plug"])
 
@@ -44,6 +46,7 @@ def get_power_status(conn, options):
 		return "on"
 
 def set_power_status(conn, options):
+	del conn
 	action = {
 		'on' : "start",
 		'off' : "stop"
@@ -53,6 +56,7 @@ def set_power_status(conn, options):
 	send_command(options, url, "POST")
 
 def get_list(conn, options):
+	del conn
 	outlets = { }
 
 	try:
diff --git a/fence/agents/vmware/fence_vmware.py b/fence/agents/vmware/fence_vmware.py
index 3a7bc61..ee65186 100644
--- a/fence/agents/vmware/fence_vmware.py
+++ b/fence/agents/vmware/fence_vmware.py
@@ -168,7 +168,7 @@ def vmware_run_command(options, add_login_params, additional_params, additional_
 
 # Get outlet list with status as hash table. If you will use add_vm_name, only VM with vmname is
 # returned. This is used in get_status function
-def vmware_get_outlets_vi(conn, options, add_vm_name):
+def vmware_get_outlets_vi(options, add_vm_name):
 	outlets = {}
 
 	if (add_vm_name):
@@ -195,7 +195,7 @@ def vmware_get_outlets_vi(conn, options, add_vm_name):
 	return outlets
 
 # Get outlet list with status as hash table.
-def vmware_get_outlets_vix(conn, options):
+def vmware_get_outlets_vix(options):
 	outlets = {}
 
 	running_machines = vmware_run_command(options, True, "list", 0)
@@ -214,10 +214,12 @@ def vmware_get_outlets_vix(conn, options):
 	return outlets
 
 def get_outlets_status(conn, options):
+	del conn
+
 	if (vmware_internal_type==VMWARE_TYPE_ESX):
-		return vmware_get_outlets_vi(conn, options, False)
+		return vmware_get_outlets_vi(options, False)
 	if ((vmware_internal_type==VMWARE_TYPE_SERVER1) or (vmware_internal_type==VMWARE_TYPE_SERVER2)):
-		return vmware_get_outlets_vix(conn, options)
+		return vmware_get_outlets_vix(options)
 
 def get_power_status(conn, options):
 	if (vmware_internal_type==VMWARE_TYPE_ESX):
@@ -234,6 +236,8 @@ def get_power_status(conn, options):
 		return ((options["--plug"] in outlets) and "on" or "off")
 
 def set_power_status(conn, options):
+	del conn
+
 	if (vmware_internal_type==VMWARE_TYPE_ESX):
 		additional_params = "--operation %s --vmname '%s'" % \
 				((options["--action"]=="on" and "on" or "off"), quote_for_run(options["--plug"]))
-- 
1.9.0



  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 ` [Cluster-devel] [PATCH 03/15] [cleanup] Remove unused variables Marek 'marx' Grac
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 ` Marek 'marx' Grac [this message]
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-13-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).