[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [PATCH 13/15] [cleanup] Remove unused arguments



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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]