fence-agents: master - fence_wti: Action 'list' prints also named groups
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=24226a...
Commit: 24226ad4008ec1c0aceaa8f3612b1114516d6847
Parent: 5e02c4f2fde20f4530efc69a340baf22a965f6e4
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Wed Apr 9 17:08:21 2014 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Wed Apr 9 17:08:21 2014 +0200
fence_wti: Action 'list' prints also named groups
Resolves: rhbz#1085887
---
fence/agents/wti/fence_wti.py | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py
index 01667fc..34d85a1 100644
--- a/fence/agents/wti/fence_wti.py
+++ b/fence/agents/wti/fence_wti.py
@@ -144,18 +144,23 @@ def get_plug_group_status(conn, options):
if ["list", "monitor"].count(options["--action"]) == 1:
- for group, status in outlet_groups:
- outlets[group] = (group, status[0])
+ results = {}
+ for group, status in outlets.items():
+ results[group] = (group, status[0])
- return outlets
+ return results
else:
return "PROBLEM"
def get_power_status(conn, options):
- ret = get_plug_status(conn, options)
+ if ["list"].count(options["--action"]) == 0:
+ ret = get_plug_status(conn, options)
- if ret == "PROBLEM":
- ret = get_plug_group_status(conn, options)
+ if ret == "PROBLEM":
+ ret = get_plug_group_status(conn, options)
+ else:
+ ret = dict(get_plug_status(conn, options).items() + \
+ get_plug_group_status(conn, options).items())
return ret
10 years, 2 months
fence-agents: master - [cleanup] Fixing small issues created during cleaning phase
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=5e02c4...
Commit: 5e02c4f2fde20f4530efc69a340baf22a965f6e4
Parent: b88f2dd7729bf5a29dd8619be9412e0f47454e91
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Wed Apr 9 16:48:53 2014 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Wed Apr 9 16:48:53 2014 +0200
[cleanup] Fixing small issues created during cleaning phase
---
fence/agents/amt/fence_amt.py | 2 +-
fence/agents/apc_snmp/fence_apc_snmp.py | 1 +
fence/agents/cisco_ucs/fence_cisco_ucs.py | 2 +-
fence/agents/eaton_snmp/fence_eaton_snmp.py | 1 +
fence/agents/ipdu/fence_ipdu.py | 1 +
fence/agents/lib/fencing.py.py | 2 +-
fence/agents/raritan/fence_raritan.py | 3 +++
7 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/fence/agents/amt/fence_amt.py b/fence/agents/amt/fence_amt.py
index b461831..0eb6caf 100644
--- a/fence/agents/amt/fence_amt.py
+++ b/fence/agents/amt/fence_amt.py
@@ -30,7 +30,7 @@ def get_power_status(_, options):
process.stderr.close()
logging.debug("%s\n" % str(out))
- match = re.search('Powerstate:[\\s]*(..)', str(output))
+ match = re.search('Powerstate:[\\s]*(..)', str(out))
status = match.group(1) if match else None
if (status == None):
diff --git a/fence/agents/apc_snmp/fence_apc_snmp.py b/fence/agents/apc_snmp/fence_apc_snmp.py
index d91e9e9..1810247 100644
--- a/fence/agents/apc_snmp/fence_apc_snmp.py
+++ b/fence/agents/apc_snmp/fence_apc_snmp.py
@@ -16,6 +16,7 @@ import sys
import atexit
sys.path.append("@FENCEAGENTSLIBDIR@")
from fencing import *
+from fencing import fail_usage
from fencing_snmp import FencingSnmp
#BEGIN_VERSION_GENERATION
diff --git a/fence/agents/cisco_ucs/fence_cisco_ucs.py b/fence/agents/cisco_ucs/fence_cisco_ucs.py
index 3ef7c7b..de0f681 100644
--- a/fence/agents/cisco_ucs/fence_cisco_ucs.py
+++ b/fence/agents/cisco_ucs/fence_cisco_ucs.py
@@ -97,7 +97,7 @@ def send_command(opt, command, timeout):
result = web_buffer.getvalue()
logging.debug("%s\n" % command)
- logging.debug("%s\n" % results)
+ logging.debug("%s\n" % result)
return result
diff --git a/fence/agents/eaton_snmp/fence_eaton_snmp.py b/fence/agents/eaton_snmp/fence_eaton_snmp.py
index 9688516..b14eef4 100644
--- a/fence/agents/eaton_snmp/fence_eaton_snmp.py
+++ b/fence/agents/eaton_snmp/fence_eaton_snmp.py
@@ -10,6 +10,7 @@ import sys
import atexit
sys.path.append("@FENCEAGENTSLIBDIR@")
from fencing import *
+from fencing import fail_usage
from fencing_snmp import FencingSnmp
#BEGIN_VERSION_GENERATION
diff --git a/fence/agents/ipdu/fence_ipdu.py b/fence/agents/ipdu/fence_ipdu.py
index 83f1dd4..479e9b8 100644
--- a/fence/agents/ipdu/fence_ipdu.py
+++ b/fence/agents/ipdu/fence_ipdu.py
@@ -9,6 +9,7 @@ import sys
import atexit
sys.path.append("/usr/share/fence")
from fencing import *
+from fencing import fail_usage
from fencing_snmp import FencingSnmp
#BEGIN_VERSION_GENERATION
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 11985d2..73c2c4a 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -866,7 +866,7 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
for outlet_id in outlets.keys():
(alias, status) = outlets[outlet_id]
if options["--action"] != "monitor":
- print outled_id + options["--separator"] + alias
+ print outlet_id + options["--separator"] + alias
return
status = get_multi_power_fn(tn, options, get_power_fn)
diff --git a/fence/agents/raritan/fence_raritan.py b/fence/agents/raritan/fence_raritan.py
index c8137b0..01059ce 100644
--- a/fence/agents/raritan/fence_raritan.py
+++ b/fence/agents/raritan/fence_raritan.py
@@ -1,8 +1,11 @@
#!/usr/bin/python
import sys, re, pexpect, exceptions
+import atexit
+import time
sys.path.append("@FENCEAGENTSLIBDIR@")
from fencing import *
+from fencing import fspawn, fail, fail_usage, TELNET_PATH, EC_LOGIN_DENIED
#BEGIN_VERSION_GENERATION
RELEASE_VERSION=""
10 years, 2 months
fence-agents: master - [cleanup] Fix invalid names of variables
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=b88f2d...
Commit: b88f2dd7729bf5a29dd8619be9412e0f47454e91
Parent: f7b40acb66cd75d459331223d69e006bc2da24ec
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Wed Apr 2 13:44:08 2014 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Wed Apr 9 16:30:25 2014 +0200
[cleanup] Fix invalid names of variables
---
fence/agents/apc/fence_apc.py | 8 ++++----
fence/agents/brocade/fence_brocade.py | 4 ++--
fence/agents/cisco_ucs/fence_cisco_ucs.py | 26 +++++++++++++-------------
fence/agents/lib/check_used_options.py | 8 ++++----
fence/agents/lib/fencing.py.py | 14 +++++++-------
fence/agents/rhevm/fence_rhevm.py | 26 +++++++++++++-------------
fence/agents/xenapi/fence_xenapi.py | 4 ++--
7 files changed, 45 insertions(+), 45 deletions(-)
diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index 1e86c07..f744583 100644
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -74,8 +74,8 @@ def get_power_status(conn, options):
["Press <ENTER>" ] + options["--command-prompt"], int(options["--shell-timeout"]))
lines = conn.before.split("\n")
show_re = re.compile(r'(^|\x0D)\s*(\d+)- (.*?)\s+(ON|OFF)\s*')
- for x in lines:
- res = show_re.search(x)
+ for line in lines:
+ res = show_re.search(line)
if (res != None):
outlets[res.group(2)] = (res.group(3), res.group(4))
conn.send_eol("")
@@ -187,8 +187,8 @@ def get_power_status5(conn, options):
show_re = re.compile(r'^\s*(\d+): (.*): (On|Off)\s*$', re.IGNORECASE)
- for x in lines:
- res = show_re.search(x)
+ for line in lines:
+ res = show_re.search(line)
if (res != None):
outlets[res.group(1)] = (res.group(2), res.group(3))
diff --git a/fence/agents/brocade/fence_brocade.py b/fence/agents/brocade/fence_brocade.py
index a60355d..35082ee 100644
--- a/fence/agents/brocade/fence_brocade.py
+++ b/fence/agents/brocade/fence_brocade.py
@@ -20,8 +20,8 @@ def get_power_status(conn, options):
show_re = re.compile(r'^\s*Persistent Disable\s*(ON|OFF)\s*$', re.IGNORECASE)
lines = conn.before.split("\n")
- for x in lines:
- res = show_re.search(x)
+ for line in lines:
+ res = show_re.search(line)
if (res != None):
# We queried if it is disabled, so we have to negate answer
if res.group(1) == "ON":
diff --git a/fence/agents/cisco_ucs/fence_cisco_ucs.py b/fence/agents/cisco_ucs/fence_cisco_ucs.py
index a9ca8fe..3ef7c7b 100644
--- a/fence/agents/cisco_ucs/fence_cisco_ucs.py
+++ b/fence/agents/cisco_ucs/fence_cisco_ucs.py
@@ -64,9 +64,9 @@ def get_list(conn, options):
lines = res.split("<lsServer ")
for i in range(1, len(lines)):
- dn = RE_GET_DN.search(lines[i]).group(1)
+ node_name = RE_GET_DN.search(lines[i]).group(1)
desc = RE_GET_DESC.search(lines[i]).group(1)
- outlets[dn] = (desc, None)
+ outlets[node_name] = (desc, None)
except AttributeError:
return { }
except IndexError:
@@ -84,17 +84,17 @@ def send_command(opt, command, timeout):
url += "//" + opt["--ip"] + ":" + str(opt["--ipport"]) + "/nuova"
## send command through pycurl
- c = pycurl.Curl()
- b = StringIO.StringIO()
- c.setopt(pycurl.URL, url)
- c.setopt(pycurl.HTTPHEADER, [ "Content-type: text/xml" ])
- c.setopt(pycurl.POSTFIELDS, command)
- c.setopt(pycurl.WRITEFUNCTION, b.write)
- c.setopt(pycurl.TIMEOUT, timeout)
- c.setopt(pycurl.SSL_VERIFYPEER, 0)
- c.setopt(pycurl.SSL_VERIFYHOST, 0)
- c.perform()
- result = b.getvalue()
+ conn = pycurl.Curl()
+ web_buffer = StringIO.StringIO()
+ conn.setopt(pycurl.URL, url)
+ conn.setopt(pycurl.HTTPHEADER, [ "Content-type: text/xml" ])
+ conn.setopt(pycurl.POSTFIELDS, command)
+ conn.setopt(pycurl.WRITEFUNCTION, web_buffer.write)
+ conn.setopt(pycurl.TIMEOUT, timeout)
+ conn.setopt(pycurl.SSL_VERIFYPEER, 0)
+ conn.setopt(pycurl.SSL_VERIFYHOST, 0)
+ conn.perform()
+ result = web_buffer.getvalue()
logging.debug("%s\n" % command)
logging.debug("%s\n" % results)
diff --git a/fence/agents/lib/check_used_options.py b/fence/agents/lib/check_used_options.py
index ce74fa9..7f821b1 100755
--- a/fence/agents/lib/check_used_options.py
+++ b/fence/agents/lib/check_used_options.py
@@ -46,13 +46,13 @@ def main():
for line in agent_file:
counter += 1
- for x in option_use_re.findall(line):
- if not available.has_key(x):
+ for option in option_use_re.findall(line):
+ if not available.has_key(option):
print "ERROR on line %d in %s: option %s is not defined" % (counter, agent, option_use_re.search(line).group(1))
without_errors = False
- for x in option_has_re.findall(line):
- if not available.has_key(x):
+ for option in option_has_re.findall(line):
+ if not available.has_key(option):
print "ERROR on line %d in %s: option %s is not defined" % (counter, agent, option_has_re.search(line).group(1))
without_errors = False
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index d5c9986..11985d2 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -409,11 +409,11 @@ def atexit_handler():
sys.exit(EC_GENERIC_ERROR)
def add_dependency_options(options):
- ## Add options which are available for every fence agent
+ ## Add also options which are available for every fence agent
added_opt = []
- for x in options + ["default"]:
- if DEPENDENCY_OPT.has_key(x):
- added_opt.extend([y for y in DEPENDENCY_OPT[x] if options.count(y) == 0])
+ for opt in options + ["default"]:
+ if DEPENDENCY_OPT.has_key(opt):
+ added_opt.extend([y for y in DEPENDENCY_OPT[opt] if options.count(y) == 0])
return added_opt
def fail_usage(message = ""):
@@ -863,10 +863,10 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
((options["--action"] == "monitor") and 1 == options["device_opt"].count("port")):
outlets = get_outlet_list(tn, options)
## keys can be numbers (port numbers) or strings (names of VM)
- for o in outlets.keys():
- (alias, status) = outlets[o]
+ for outlet_id in outlets.keys():
+ (alias, status) = outlets[outlet_id]
if options["--action"] != "monitor":
- print o + options["--separator"] + alias
+ print outled_id + options["--separator"] + alias
return
status = get_multi_power_fn(tn, options, get_power_fn)
diff --git a/fence/agents/rhevm/fence_rhevm.py b/fence/agents/rhevm/fence_rhevm.py
index 8efdc45..767c098 100644
--- a/fence/agents/rhevm/fence_rhevm.py
+++ b/fence/agents/rhevm/fence_rhevm.py
@@ -84,22 +84,22 @@ def send_command(opt, command, method = "GET"):
url += "//" + opt["--ip"] + ":" + str(opt["--ipport"]) + "/api/" + command
## send command through pycurl
- c = pycurl.Curl()
- b = StringIO.StringIO()
- c.setopt(pycurl.URL, url)
- c.setopt(pycurl.HTTPHEADER, [ "Content-type: application/xml", "Accept: application/xml" ])
- c.setopt(pycurl.HTTPAUTH, pycurl.HTTPAUTH_BASIC)
- c.setopt(pycurl.USERPWD, opt["--username"] + ":" + opt["--password"])
- c.setopt(pycurl.TIMEOUT, int(opt["--shell-timeout"]))
- c.setopt(pycurl.SSL_VERIFYPEER, 0)
- c.setopt(pycurl.SSL_VERIFYHOST, 0)
+ conn = pycurl.Curl()
+ web_buffer = StringIO.StringIO()
+ conn.setopt(pycurl.URL, url)
+ conn.setopt(pycurl.HTTPHEADER, [ "Content-type: application/xml", "Accept: application/xml" ])
+ conn.setopt(pycurl.HTTPAUTH, pycurl.HTTPAUTH_BASIC)
+ conn.setopt(pycurl.USERPWD, opt["--username"] + ":" + opt["--password"])
+ conn.setopt(pycurl.TIMEOUT, int(opt["--shell-timeout"]))
+ conn.setopt(pycurl.SSL_VERIFYPEER, 0)
+ conn.setopt(pycurl.SSL_VERIFYHOST, 0)
if (method == "POST"):
- c.setopt(pycurl.POSTFIELDS, "<action />")
+ conn.setopt(pycurl.POSTFIELDS, "<action />")
- c.setopt(pycurl.WRITEFUNCTION, b.write)
- c.perform()
- result = b.getvalue()
+ conn.setopt(pycurl.WRITEFUNCTION, web_buffer.write)
+ conn.perform()
+ result = web_buffer.getvalue()
logging.debug("%s\n" % command)
logging.debug("%s\n" % result)
diff --git a/fence/agents/xenapi/fence_xenapi.py b/fence/agents/xenapi/fence_xenapi.py
index 3b6454c..2a52c98 100644
--- a/fence/agents/xenapi/fence_xenapi.py
+++ b/fence/agents/xenapi/fence_xenapi.py
@@ -217,10 +217,10 @@ the status of virtual machines running on the host."
docs["vendorurl"] = "http://www.xenproject.org"
show_docs(options, docs)
- xenSession = connect_and_login(options)
+ xen_session = connect_and_login(options)
# Operate the fencing device
- result = fence_action(xenSession, options, set_power_fn, get_power_fn, get_outlet_list)
+ result = fence_action(xen_session, options, set_power_fn, get_power_fn, get_outlet_list)
sys.exit(result)
10 years, 2 months
fence-agents: master - [cleanup] Remove transfer script used in transition 3.x->4.x
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=f7b40a...
Commit: f7b40acb66cd75d459331223d69e006bc2da24ec
Parent: 6eaabc97fd4265c94f22640ddad3b97b0416a632
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Mar 31 14:50:20 2014 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Wed Apr 9 16:30:19 2014 +0200
[cleanup] Remove transfer script used in transition 3.x->4.x
---
fence/agents/lib/transfer.py | 16 ----------------
1 files changed, 0 insertions(+), 16 deletions(-)
diff --git a/fence/agents/lib/transfer.py b/fence/agents/lib/transfer.py
deleted file mode 100755
index b7a39db..0000000
--- a/fence/agents/lib/transfer.py
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/python -tt
-
-from fencing import *
-
-def main():
- for key in all_opt.keys():
- if all_opt[key].has_key("getopt") and all_opt[key].has_key("longopt"):
- print "s/options\[\"-" + all_opt[key]["getopt"].rstrip(":") + "\"\]/options[\"--" + \
- all_opt[key]["longopt"] + "\"]/g"
- print "s/options.has_key(\"-" + all_opt[key]["getopt"].rstrip(":") + "\")/options.has_key(" + \
- "\"--" + all_opt[key]["longopt"] + "\")/g"
-
-
-
-if __name__ == "__main__":
- main()
\ No newline at end of file
10 years, 2 months
fence-agents: master - [cleanup] Remove unused arguments
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=6eaabc...
Commit: 6eaabc97fd4265c94f22640ddad3b97b0416a632
Parent: 91dcb051959c5e70094cbb3c5b5243e4a328d8bc
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Mar 31 14:47:57 2014 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Wed Apr 9 16:30:12 2014 +0200
[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 d2777de..a9ca8fe 100644
--- a/fence/agents/cisco_ucs/fence_cisco_ucs.py
+++ b/fence/agents/cisco_ucs/fence_cisco_ucs.py
@@ -21,6 +21,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"]))
@@ -37,6 +39,8 @@ def get_power_status(conn, options):
return "off"
def set_power_status(conn, options):
+ del conn
+
action = {
'on' : "up",
'off' : "down"
@@ -51,6 +55,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 ff67e7b..aa1e5c2 100644
--- a/fence/agents/dummy/fence_dummy.py
+++ b/fence/agents/dummy/fence_dummy.py
@@ -17,6 +17,8 @@ BUILD_DATE=""
plug_status = "on"
def get_power_status_file(conn, options):
+ del conn
+
try:
status_file = open(options["--status-file"], 'r')
except:
@@ -28,6 +30,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
@@ -45,12 +49,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 0d9e573..3a52b3c 100644
--- a/fence/agents/eps/fence_eps.py
+++ b/fence/agents/eps/fence_eps.py
@@ -63,6 +63,7 @@ def eps_run_command(options, params):
return result
def get_power_status(conn, options):
+ del conn
ret_val = eps_run_command(options,"")
result = {}
@@ -79,6 +80,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 c8760d9..8efdc45 100644
--- a/fence/agents/rhevm/fence_rhevm.py
+++ b/fence/agents/rhevm/fence_rhevm.py
@@ -20,6 +20,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"])
@@ -45,6 +47,7 @@ def get_power_status(conn, options):
return "on"
def set_power_status(conn, options):
+ del conn
action = {
'on' : "start",
'off' : "stop"
@@ -54,6 +57,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 f645650..c9310fb 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"]))
10 years, 2 months
fence-agents: master - [cleanup] Remove snmp_define_defaults()
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=91dcb0...
Commit: 91dcb051959c5e70094cbb3c5b5243e4a328d8bc
Parent: 9c514959fef7a326f17fc1e70f3df76494a2b792
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Mar 31 14:27:53 2014 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Wed Apr 9 16:30:05 2014 +0200
[cleanup] Remove snmp_define_defaults()
This function is always called for SNMP fence agents so it is possible to run it automatically.
---
fence/agents/apc_snmp/fence_apc_snmp.py | 11 +++--------
fence/agents/cisco_mds/fence_cisco_mds.py | 4 +---
fence/agents/eaton_snmp/fence_eaton_snmp.py | 4 +---
fence/agents/ibmblade/fence_ibmblade.py | 3 +--
fence/agents/ifmib/fence_ifmib.py | 3 +--
fence/agents/intelmodular/fence_intelmodular.py | 4 +---
fence/agents/ipdu/fence_ipdu.py | 3 +--
fence/agents/lib/fencing.py.py | 3 +++
fence/agents/lib/fencing_snmp.py.py | 6 +-----
9 files changed, 13 insertions(+), 28 deletions(-)
diff --git a/fence/agents/apc_snmp/fence_apc_snmp.py b/fence/agents/apc_snmp/fence_apc_snmp.py
index 2461476..29aafe6 100644
--- a/fence/agents/apc_snmp/fence_apc_snmp.py
+++ b/fence/agents/apc_snmp/fence_apc_snmp.py
@@ -16,7 +16,7 @@ import sys
import atexit
sys.path.append("@FENCEAGENTSLIBDIR@")
from fencing import *
-from fencing_snmp import *
+from fencing_snmp import FencingSnmp
#BEGIN_VERSION_GENERATION
RELEASE_VERSION="APC SNMP fence agent"
@@ -169,11 +169,6 @@ def get_outlets_status(conn, options):
return result
-# Define new options
-def apc_snmp_define_defaults():
- all_opt["snmp_version"]["default"] = "1"
- all_opt["community"]["default"] = "private"
-
# Main agent method
def main():
device_opt = [ "ipaddr", "login", "passwd", "no_login", "no_password", \
@@ -181,8 +176,8 @@ def main():
atexit.register(atexit_handler)
- snmp_define_defaults ()
- apc_snmp_define_defaults()
+ all_opt["snmp_version"]["default"] = "1"
+ all_opt["community"]["default"] = "private"
options = check_input(device_opt, process_input(device_opt))
diff --git a/fence/agents/cisco_mds/fence_cisco_mds.py b/fence/agents/cisco_mds/fence_cisco_mds.py
index 6cc189f..84adee2 100644
--- a/fence/agents/cisco_mds/fence_cisco_mds.py
+++ b/fence/agents/cisco_mds/fence_cisco_mds.py
@@ -11,7 +11,7 @@ import atexit
sys.path.append("@FENCEAGENTSLIBDIR@")
from fencing import *
from fencing import fail_usage
-from fencing_snmp import *
+from fencing_snmp import FencingSnmp
#BEGIN_VERSION_GENERATION
RELEASE_VERSION="Cisco MDS 9xxx SNMP fence agent"
@@ -84,8 +84,6 @@ def main():
atexit.register(atexit_handler)
- snmp_define_defaults ()
-
options = check_input(device_opt, process_input(device_opt))
docs = { }
diff --git a/fence/agents/eaton_snmp/fence_eaton_snmp.py b/fence/agents/eaton_snmp/fence_eaton_snmp.py
index f519be8..970fd69 100644
--- a/fence/agents/eaton_snmp/fence_eaton_snmp.py
+++ b/fence/agents/eaton_snmp/fence_eaton_snmp.py
@@ -10,7 +10,7 @@ import sys
import atexit
sys.path.append("@FENCEAGENTSLIBDIR@")
from fencing import *
-from fencing_snmp import *
+from fencing_snmp import FencingSnmp
#BEGIN_VERSION_GENERATION
RELEASE_VERSION="Eaton SNMP fence agent"
@@ -204,8 +204,6 @@ def main():
atexit.register(atexit_handler)
- snmp_define_defaults ()
-
all_opt["switch"]["default"] = 1
all_opt["power_wait"]["default"] = 2
all_opt["snmp_version"]["default"] = "1"
diff --git a/fence/agents/ibmblade/fence_ibmblade.py b/fence/agents/ibmblade/fence_ibmblade.py
index 43bc73e..d1bb065 100644
--- a/fence/agents/ibmblade/fence_ibmblade.py
+++ b/fence/agents/ibmblade/fence_ibmblade.py
@@ -4,7 +4,7 @@ import sys
import atexit
sys.path.append("@FENCEAGENTSLIBDIR@")
from fencing import *
-from fencing_snmp import *
+from fencing_snmp import FencingSnmp
#BEGIN_VERSION_GENERATION
RELEASE_VERSION="IBM Blade SNMP fence agent"
@@ -57,7 +57,6 @@ def main():
atexit.register(atexit_handler)
- snmp_define_defaults()
all_opt["snmp_version"]["default"] = "1"
options = check_input(device_opt, process_input(device_opt))
diff --git a/fence/agents/ifmib/fence_ifmib.py b/fence/agents/ifmib/fence_ifmib.py
index 350ce71..f8beaa5 100644
--- a/fence/agents/ifmib/fence_ifmib.py
+++ b/fence/agents/ifmib/fence_ifmib.py
@@ -13,7 +13,7 @@ import atexit
sys.path.append("@FENCEAGENTSLIBDIR@")
from fencing import *
from fencing import fail_usage
-from fencing_snmp import *
+from fencing_snmp import FencingSnmp
#BEGIN_VERSION_GENERATION
RELEASE_VERSION="IF:MIB SNMP fence agent"
@@ -102,7 +102,6 @@ def main():
atexit.register(atexit_handler)
- snmp_define_defaults ()
all_opt["snmp_version"]["default"] = "2c"
options = check_input(device_opt, process_input(device_opt))
diff --git a/fence/agents/intelmodular/fence_intelmodular.py b/fence/agents/intelmodular/fence_intelmodular.py
index 320b2db..e9ef43c 100644
--- a/fence/agents/intelmodular/fence_intelmodular.py
+++ b/fence/agents/intelmodular/fence_intelmodular.py
@@ -15,7 +15,7 @@ import sys
import atexit
sys.path.append("@FENCEAGENTSLIBDIR@")
from fencing import *
-from fencing_snmp import *
+from fencing_snmp import FencingSnmp
#BEGIN_VERSION_GENERATION
RELEASE_VERSION="Intel Modular SNMP fence agent"
@@ -68,8 +68,6 @@ def main():
atexit.register(atexit_handler)
- snmp_define_defaults ()
-
options = check_input(device_opt, process_input(device_opt))
docs = { }
diff --git a/fence/agents/ipdu/fence_ipdu.py b/fence/agents/ipdu/fence_ipdu.py
index 62a2df4..83f1dd4 100644
--- a/fence/agents/ipdu/fence_ipdu.py
+++ b/fence/agents/ipdu/fence_ipdu.py
@@ -9,7 +9,7 @@ import sys
import atexit
sys.path.append("/usr/share/fence")
from fencing import *
-from fencing_snmp import *
+from fencing_snmp import FencingSnmp
#BEGIN_VERSION_GENERATION
RELEASE_VERSION="IBM iPDU SNMP fence agent"
@@ -133,7 +133,6 @@ def main():
atexit.register(atexit_handler)
- snmp_define_defaults ()
all_opt["snmp_version"]["default"] = "3"
all_opt["community"]["default"] = "private"
all_opt["switch"]["default"] = "1"
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 291115f..d5c9986 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -648,6 +648,9 @@ def check_input(device_opt, opt):
if options.has_key("--ipport"):
all_opt["ipport"]["help"] = "-u, --ipport=[port] " + \
"TCP/UDP port to use (default " + options["--ipport"] +")"
+ elif device_opt.count("snmp_version"):
+ all_opt["ipport"]["default"] = "161"
+ all_opt["ipport"]["help"] = "-u, --ipport=[port] TCP/UDP port to use (default 161)"
elif options.has_key("--ssh"):
all_opt["ipport"]["default"] = 22
all_opt["ipport"]["help"] = "-u, --ipport=[port] TCP/UDP port to use (default 22)"
diff --git a/fence/agents/lib/fencing_snmp.py.py b/fence/agents/lib/fencing_snmp.py.py
index 1cd8231..d8dd746 100644
--- a/fence/agents/lib/fencing_snmp.py.py
+++ b/fence/agents/lib/fencing_snmp.py.py
@@ -7,7 +7,7 @@ import logging
from fencing import *
from fencing import fail, fail_usage, EC_TIMED_OUT, LOG_MODE_VERBOSE
-__all__ = [ 'FencingSnmp', 'snmp_define_defaults' ]
+__all__ = [ 'FencingSnmp' ]
## do not add code here.
#BEGIN_VERSION_GENERATION
@@ -16,10 +16,6 @@ REDHAT_COPYRIGHT = ""
BUILD_DATE = ""
#END_VERSION_GENERATION
-# Fix for RHBZ#527844
-def snmp_define_defaults ():
- all_opt["ipport"]["default"] = "161"
-
class FencingSnmp:
def __init__(self, options):
self.options = options
10 years, 2 months
fence-agents: master - [cleanup] Mark raw strings with r"" in fence_virsh
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=9c5149...
Commit: 9c514959fef7a326f17fc1e70f3df76494a2b792
Parent: 76006e9d5c88a64a55d89843a8f6e54f6385d2ad
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Mar 31 14:12:29 2014 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Wed Apr 9 16:29:58 2014 +0200
[cleanup] Mark raw strings with r"" in fence_virsh
---
fence/agents/virsh/fence_virsh.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fence/agents/virsh/fence_virsh.py b/fence/agents/virsh/fence_virsh.py
index c1cbc65..cbdb399 100644
--- a/fence/agents/virsh/fence_virsh.py
+++ b/fence/agents/virsh/fence_virsh.py
@@ -73,8 +73,8 @@ def main():
atexit.register(atexit_handler)
all_opt["secure"]["default"] = "1"
- all_opt["cmd_prompt"]["default"] = [ "\[EXPECT\]#\ " ]
- all_opt["ssh_options"]["default"] = "-t '/bin/bash -c \"PS1=\[EXPECT\]#\ /bin/bash --noprofile --norc\"'"
+ all_opt["cmd_prompt"]["default"] = [ r"\[EXPECT\]#\ " ]
+ all_opt["ssh_options"]["default"] = "-t '/bin/bash -c \"" + r"PS1=\[EXPECT\]#\ " + "/bin/bash --noprofile --norc\"'"
options = check_input(device_opt, process_input(device_opt))
10 years, 2 months
fence-agents: master - [cleanup] Errors when encountering mixed space/tab in python
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=76006e...
Commit: 76006e9d5c88a64a55d89843a8f6e54f6385d2ad
Parent: 16609180f88a7a486e8207c92496fabc0ba5c885
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Mar 31 13:50:37 2014 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Wed Apr 9 16:29:51 2014 +0200
[cleanup] Errors when encountering mixed space/tab in python
---
fence/agents/alom/fence_alom.py | 2 +-
fence/agents/amt/fence_amt.py | 2 +-
fence/agents/apc/fence_apc.py | 2 +-
fence/agents/apc_snmp/fence_apc_snmp.py | 2 +-
fence/agents/bladecenter/fence_bladecenter.py | 2 +-
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/drac/fence_drac.py | 2 +-
fence/agents/drac5/fence_drac5.py | 2 +-
fence/agents/dummy/fence_dummy.py | 2 +-
fence/agents/eaton_snmp/fence_eaton_snmp.py | 2 +-
fence/agents/eps/fence_eps.py | 2 +-
fence/agents/hds_cb/fence_hds_cb.py | 2 +-
fence/agents/hpblade/fence_hpblade.py | 2 +-
fence/agents/ibmblade/fence_ibmblade.py | 2 +-
fence/agents/ifmib/fence_ifmib.py | 2 +-
fence/agents/ilo/fence_ilo.py | 2 +-
fence/agents/ilo_mp/fence_ilo_mp.py | 2 +-
fence/agents/intelmodular/fence_intelmodular.py | 2 +-
fence/agents/ipdu/fence_ipdu.py | 2 +-
fence/agents/ipmilan/fence_ipmilan.py | 2 +-
fence/agents/ldom/fence_ldom.py | 2 +-
fence/agents/lib/check_used_options.py | 2 +-
fence/agents/lib/fencing.py.py | 2 +-
fence/agents/lib/fencing_snmp.py.py | 2 +-
fence/agents/lib/transfer.py | 2 +-
fence/agents/lpar/fence_lpar.py | 2 +-
fence/agents/netio/fence_netio.py | 2 +-
fence/agents/ovh/fence_ovh.py | 2 +-
fence/agents/rhevm/fence_rhevm.py | 2 +-
fence/agents/rsa/fence_rsa.py | 2 +-
fence/agents/rsb/fence_rsb.py | 2 +-
fence/agents/sanbox2/fence_sanbox2.py | 2 +-
fence/agents/virsh/fence_virsh.py | 2 +-
fence/agents/vmware/fence_vmware.py | 2 +-
fence/agents/vmware_soap/fence_vmware_soap.py | 2 +-
fence/agents/wti/fence_wti.py | 2 +-
fence/agents/xenapi/fence_xenapi.py | 2 +-
39 files changed, 39 insertions(+), 39 deletions(-)
diff --git a/fence/agents/alom/fence_alom.py b/fence/agents/alom/fence_alom.py
index 2a72d7e..c2af527 100644
--- a/fence/agents/alom/fence_alom.py
+++ b/fence/agents/alom/fence_alom.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
# The Following Agent Has Been Tested On:
#
diff --git a/fence/agents/amt/fence_amt.py b/fence/agents/amt/fence_amt.py
index 497976b..b461831 100644
--- a/fence/agents/amt/fence_amt.py
+++ b/fence/agents/amt/fence_amt.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
import sys, subprocess, re
import logging
diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index 3b17cd0..1e86c07 100644
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
#####
##
diff --git a/fence/agents/apc_snmp/fence_apc_snmp.py b/fence/agents/apc_snmp/fence_apc_snmp.py
index b07d04a..2461476 100644
--- a/fence/agents/apc_snmp/fence_apc_snmp.py
+++ b/fence/agents/apc_snmp/fence_apc_snmp.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
# The Following agent has been tested on:
# - APC Switched Rack PDU - SNMP v1
diff --git a/fence/agents/bladecenter/fence_bladecenter.py b/fence/agents/bladecenter/fence_bladecenter.py
index 3bb02fc..0f59f55 100644
--- a/fence/agents/bladecenter/fence_bladecenter.py
+++ b/fence/agents/bladecenter/fence_bladecenter.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
#####
##
diff --git a/fence/agents/brocade/fence_brocade.py b/fence/agents/brocade/fence_brocade.py
index c6b2bfc..a60355d 100644
--- a/fence/agents/brocade/fence_brocade.py
+++ b/fence/agents/brocade/fence_brocade.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
import sys, re
import atexit
diff --git a/fence/agents/cisco_mds/fence_cisco_mds.py b/fence/agents/cisco_mds/fence_cisco_mds.py
index dc6c41b..6cc189f 100644
--- a/fence/agents/cisco_mds/fence_cisco_mds.py
+++ b/fence/agents/cisco_mds/fence_cisco_mds.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
# The Following agent has been tested on:
# - Cisco MDS UROS 9134 FC (1 Slot) Chassis ("1/2/4 10 Gbps FC/Supervisor-2") Motorola, e500v2
diff --git a/fence/agents/cisco_ucs/fence_cisco_ucs.py b/fence/agents/cisco_ucs/fence_cisco_ucs.py
index 9852515..d2777de 100644
--- a/fence/agents/cisco_ucs/fence_cisco_ucs.py
+++ b/fence/agents/cisco_ucs/fence_cisco_ucs.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
import sys, re
import pycurl, StringIO
diff --git a/fence/agents/drac/fence_drac.py b/fence/agents/drac/fence_drac.py
index 396f09e..b858d62 100644
--- a/fence/agents/drac/fence_drac.py
+++ b/fence/agents/drac/fence_drac.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
import sys, re
import atexit
diff --git a/fence/agents/drac5/fence_drac5.py b/fence/agents/drac5/fence_drac5.py
index cdf4f4f..7d8fe9a 100644
--- a/fence/agents/drac5/fence_drac5.py
+++ b/fence/agents/drac5/fence_drac5.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
#####
##
diff --git a/fence/agents/dummy/fence_dummy.py b/fence/agents/dummy/fence_dummy.py
index 8996c74..ff67e7b 100644
--- a/fence/agents/dummy/fence_dummy.py
+++ b/fence/agents/dummy/fence_dummy.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
import sys, random
import logging
diff --git a/fence/agents/eaton_snmp/fence_eaton_snmp.py b/fence/agents/eaton_snmp/fence_eaton_snmp.py
index a329aeb..f519be8 100644
--- a/fence/agents/eaton_snmp/fence_eaton_snmp.py
+++ b/fence/agents/eaton_snmp/fence_eaton_snmp.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
# The Following agent has been tested on:
# - Eaton ePDU Managed - SNMP v1
diff --git a/fence/agents/eps/fence_eps.py b/fence/agents/eps/fence_eps.py
index dbf5e5b..0d9e573 100644
--- a/fence/agents/eps/fence_eps.py
+++ b/fence/agents/eps/fence_eps.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
# The Following Agent Has Been Tested On:
# ePowerSwitch 8M+ version 1.0.0.4
diff --git a/fence/agents/hds_cb/fence_hds_cb.py b/fence/agents/hds_cb/fence_hds_cb.py
index 70ca185..f895fd3 100755
--- a/fence/agents/hds_cb/fence_hds_cb.py
+++ b/fence/agents/hds_cb/fence_hds_cb.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
#####
##
diff --git a/fence/agents/hpblade/fence_hpblade.py b/fence/agents/hpblade/fence_hpblade.py
index 6b883db..636c77d 100644
--- a/fence/agents/hpblade/fence_hpblade.py
+++ b/fence/agents/hpblade/fence_hpblade.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
#####
##
diff --git a/fence/agents/ibmblade/fence_ibmblade.py b/fence/agents/ibmblade/fence_ibmblade.py
index 1e60e7d..43bc73e 100644
--- a/fence/agents/ibmblade/fence_ibmblade.py
+++ b/fence/agents/ibmblade/fence_ibmblade.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
import sys
import atexit
diff --git a/fence/agents/ifmib/fence_ifmib.py b/fence/agents/ifmib/fence_ifmib.py
index 3ecc85d..350ce71 100644
--- a/fence/agents/ifmib/fence_ifmib.py
+++ b/fence/agents/ifmib/fence_ifmib.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
# The Following agent has been tested on:
# - Cisco MDS UROS 9134 FC (1 Slot) Chassis ("1/2/4 10 Gbps FC/Supervisor-2") Motorola, e500v2
diff --git a/fence/agents/ilo/fence_ilo.py b/fence/agents/ilo/fence_ilo.py
index 8719573..f45e749 100644
--- a/fence/agents/ilo/fence_ilo.py
+++ b/fence/agents/ilo/fence_ilo.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
#####
##
diff --git a/fence/agents/ilo_mp/fence_ilo_mp.py b/fence/agents/ilo_mp/fence_ilo_mp.py
index c76c281..1d874c1 100644
--- a/fence/agents/ilo_mp/fence_ilo_mp.py
+++ b/fence/agents/ilo_mp/fence_ilo_mp.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
import sys, re
import atexit
diff --git a/fence/agents/intelmodular/fence_intelmodular.py b/fence/agents/intelmodular/fence_intelmodular.py
index bd1faee..320b2db 100644
--- a/fence/agents/intelmodular/fence_intelmodular.py
+++ b/fence/agents/intelmodular/fence_intelmodular.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
# Tested with an Intel MFSYS25 using firmware package 2.6 Should work with an
# MFSYS35 as well.
diff --git a/fence/agents/ipdu/fence_ipdu.py b/fence/agents/ipdu/fence_ipdu.py
index c1fc368..62a2df4 100644
--- a/fence/agents/ipdu/fence_ipdu.py
+++ b/fence/agents/ipdu/fence_ipdu.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
# The Following agent has been tested on:
# IBM iPDU model 46M4002
diff --git a/fence/agents/ipmilan/fence_ipmilan.py b/fence/agents/ipmilan/fence_ipmilan.py
index 804928b..b120d6b 100644
--- a/fence/agents/ipmilan/fence_ipmilan.py
+++ b/fence/agents/ipmilan/fence_ipmilan.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
import sys, shlex, subprocess, re, os
import logging
diff --git a/fence/agents/ldom/fence_ldom.py b/fence/agents/ldom/fence_ldom.py
index 7545eed..65c810b 100644
--- a/fence/agents/ldom/fence_ldom.py
+++ b/fence/agents/ldom/fence_ldom.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
##
## The Following Agent Has Been Tested On - LDOM 1.0.3
diff --git a/fence/agents/lib/check_used_options.py b/fence/agents/lib/check_used_options.py
index 92a2ae6..ce74fa9 100755
--- a/fence/agents/lib/check_used_options.py
+++ b/fence/agents/lib/check_used_options.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
## Check if fence agent uses only options["--??"] which are defined in fencing library or
## fence agent itself
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index a5f9ecf..291115f 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
import sys, getopt, time, os, uuid, pycurl, stat
import pexpect, re, atexit, syslog
diff --git a/fence/agents/lib/fencing_snmp.py.py b/fence/agents/lib/fencing_snmp.py.py
index 3709ec8..1cd8231 100644
--- a/fence/agents/lib/fencing_snmp.py.py
+++ b/fence/agents/lib/fencing_snmp.py.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
# For example of use please see fence_cisco_mds
diff --git a/fence/agents/lib/transfer.py b/fence/agents/lib/transfer.py
index ddf2486..b7a39db 100755
--- a/fence/agents/lib/transfer.py
+++ b/fence/agents/lib/transfer.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
from fencing import *
diff --git a/fence/agents/lpar/fence_lpar.py b/fence/agents/lpar/fence_lpar.py
index 630b2ca..304ebe4 100644
--- a/fence/agents/lpar/fence_lpar.py
+++ b/fence/agents/lpar/fence_lpar.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
#####
##
diff --git a/fence/agents/netio/fence_netio.py b/fence/agents/netio/fence_netio.py
index a1b4abf..4708ff6 100755
--- a/fence/agents/netio/fence_netio.py
+++ b/fence/agents/netio/fence_netio.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
import sys, re, pexpect
import atexit
diff --git a/fence/agents/ovh/fence_ovh.py b/fence/agents/ovh/fence_ovh.py
index c57ed86..cd33b17 100644
--- a/fence/agents/ovh/fence_ovh.py
+++ b/fence/agents/ovh/fence_ovh.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
# Copyright 2013 Adrian Gibanel Lopez (bTactic)
# Adrian Gibanel improved this script at 2013 to add verification of success and to output metadata
diff --git a/fence/agents/rhevm/fence_rhevm.py b/fence/agents/rhevm/fence_rhevm.py
index 807084d..c8760d9 100644
--- a/fence/agents/rhevm/fence_rhevm.py
+++ b/fence/agents/rhevm/fence_rhevm.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
import sys, re
import pycurl, StringIO
diff --git a/fence/agents/rsa/fence_rsa.py b/fence/agents/rsa/fence_rsa.py
index 4e855a2..ba93709 100644
--- a/fence/agents/rsa/fence_rsa.py
+++ b/fence/agents/rsa/fence_rsa.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
#####
##
diff --git a/fence/agents/rsb/fence_rsb.py b/fence/agents/rsb/fence_rsb.py
index af3a2e4..b72d295 100755
--- a/fence/agents/rsb/fence_rsb.py
+++ b/fence/agents/rsb/fence_rsb.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
import sys, re
import atexit
diff --git a/fence/agents/sanbox2/fence_sanbox2.py b/fence/agents/sanbox2/fence_sanbox2.py
index e2c944b..161e002 100644
--- a/fence/agents/sanbox2/fence_sanbox2.py
+++ b/fence/agents/sanbox2/fence_sanbox2.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
#####
##
diff --git a/fence/agents/virsh/fence_virsh.py b/fence/agents/virsh/fence_virsh.py
index f03ea74..c1cbc65 100644
--- a/fence/agents/virsh/fence_virsh.py
+++ b/fence/agents/virsh/fence_virsh.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
# The Following Agent Has Been Tested On:
#
diff --git a/fence/agents/vmware/fence_vmware.py b/fence/agents/vmware/fence_vmware.py
index 79f58b1..f645650 100644
--- a/fence/agents/vmware/fence_vmware.py
+++ b/fence/agents/vmware/fence_vmware.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
#
# The Following agent has been tested on:
diff --git a/fence/agents/vmware_soap/fence_vmware_soap.py b/fence/agents/vmware_soap/fence_vmware_soap.py
index f944a04..ccdbac1 100644
--- a/fence/agents/vmware_soap/fence_vmware_soap.py
+++ b/fence/agents/vmware_soap/fence_vmware_soap.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
import sys, time
import shutil, tempfile, suds
diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py
index da68b66..01667fc 100644
--- a/fence/agents/wti/fence_wti.py
+++ b/fence/agents/wti/fence_wti.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
#####
##
diff --git a/fence/agents/xenapi/fence_xenapi.py b/fence/agents/xenapi/fence_xenapi.py
index 8b9857c..3b6454c 100644
--- a/fence/agents/xenapi/fence_xenapi.py
+++ b/fence/agents/xenapi/fence_xenapi.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -tt
#
#############################################################################
# Copyright 2011 Matthew Clark
10 years, 2 months
fence-agents: master - [cleanup] Only symbols that should be used are exported from fencing_snmp library
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=166091...
Commit: 16609180f88a7a486e8207c92496fabc0ba5c885
Parent: 46b9a2abda2b9b26d7406fd092b7a255d5191afb
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Mar 31 13:46:10 2014 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Wed Apr 9 16:29:44 2014 +0200
[cleanup] Only symbols that should be used are exported from fencing_snmp library
---
fence/agents/lib/fencing_snmp.py.py | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/fence/agents/lib/fencing_snmp.py.py b/fence/agents/lib/fencing_snmp.py.py
index 9285703..3709ec8 100644
--- a/fence/agents/lib/fencing_snmp.py.py
+++ b/fence/agents/lib/fencing_snmp.py.py
@@ -7,6 +7,8 @@ import logging
from fencing import *
from fencing import fail, fail_usage, EC_TIMED_OUT, LOG_MODE_VERBOSE
+__all__ = [ 'FencingSnmp', 'snmp_define_defaults' ]
+
## do not add code here.
#BEGIN_VERSION_GENERATION
RELEASE_VERSION = ""
10 years, 2 months
fence-agents: master - [cleanup] Mark raw strings with r""
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=46b9a2...
Commit: 46b9a2abda2b9b26d7406fd092b7a255d5191afb
Parent: 63e66e0588cc2a734fc31a1a716fd8b10f6c4b7e
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Mar 31 13:16:15 2014 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Wed Apr 9 16:29:39 2014 +0200
[cleanup] Mark raw strings with r""
---
fence/agents/alom/fence_alom.py | 2 +-
fence/agents/apc/fence_apc.py | 6 +++---
fence/agents/bladecenter/fence_bladecenter.py | 6 +++---
fence/agents/brocade/fence_brocade.py | 2 +-
fence/agents/cisco_mds/fence_cisco_mds.py | 4 ++--
fence/agents/drac/fence_drac.py | 2 +-
fence/agents/drac5/fence_drac5.py | 8 ++++----
fence/agents/eps/fence_eps.py | 2 +-
fence/agents/hds_cb/fence_hds_cb.py | 4 ++--
fence/agents/hpblade/fence_hpblade.py | 4 ++--
fence/agents/ilo/fence_ilo.py | 6 +++---
fence/agents/ldom/fence_ldom.py | 6 +++---
fence/agents/lib/check_used_options.py | 8 ++++----
fence/agents/lib/fencing.py.py | 4 ++--
fence/agents/lpar/fence_lpar.py | 2 +-
fence/agents/rsb/fence_rsb.py | 2 +-
fence/agents/sanbox2/fence_sanbox2.py | 6 +++---
fence/agents/virsh/fence_virsh.py | 2 +-
fence/agents/vmware/fence_vmware.py | 2 +-
19 files changed, 39 insertions(+), 39 deletions(-)
diff --git a/fence/agents/alom/fence_alom.py b/fence/agents/alom/fence_alom.py
index 2844904..2a72d7e 100644
--- a/fence/agents/alom/fence_alom.py
+++ b/fence/agents/alom/fence_alom.py
@@ -37,7 +37,7 @@ def main():
atexit.register(atexit_handler)
all_opt["secure"]["default"] = "1"
- all_opt["cmd_prompt"]["default"] = [ "sc\>\ " ]
+ all_opt["cmd_prompt"]["default"] = [ r"sc\>\ " ]
options = check_input(device_opt, process_input(device_opt))
options["telnet_over_ssh"] = 1
diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index 76b544b..3b17cd0 100644
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -73,7 +73,7 @@ def get_power_status(conn, options):
exp_result = conn.log_expect(options,
["Press <ENTER>" ] + options["--command-prompt"], int(options["--shell-timeout"]))
lines = conn.before.split("\n")
- show_re = re.compile('(^|\x0D)\s*(\d+)- (.*?)\s+(ON|OFF)\s*')
+ show_re = re.compile(r'(^|\x0D)\s*(\d+)- (.*?)\s+(ON|OFF)\s*')
for x in lines:
res = show_re.search(x)
if (res != None):
@@ -185,7 +185,7 @@ def get_power_status5(conn, options):
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)
+ show_re = re.compile(r'^\s*(\d+): (.*): (On|Off)\s*$', re.IGNORECASE)
for x in lines:
res = show_re.search(x)
@@ -246,7 +246,7 @@ will block any necessary fencing actions."
## and continue with proper action
####
result = -1
- firmware_version = re.compile('\s*v(\d)*\.').search(conn.before)
+ firmware_version = re.compile(r'\s*v(\d)*\.').search(conn.before)
if (firmware_version != None) and (firmware_version.group(1) == "5"):
result = fence_action(conn, options, set_power_status5, get_power_status5, get_power_status5)
else:
diff --git a/fence/agents/bladecenter/fence_bladecenter.py b/fence/agents/bladecenter/fence_bladecenter.py
index 34a8975..3bb02fc 100644
--- a/fence/agents/bladecenter/fence_bladecenter.py
+++ b/fence/agents/bladecenter/fence_bladecenter.py
@@ -25,7 +25,7 @@ BUILD_DATE="March, 2008"
#END_VERSION_GENERATION
def get_power_status(conn, options):
- node_cmd = "system:blade\[" + options["--plug"] + "\]>"
+ node_cmd = r"system:blade\[" + options["--plug"] + r"\]>"
conn.send_eol("env -T system:blade[" + options["--plug"] + "]")
i = conn.log_expect(options, [ node_cmd, "system>" ] , int(options["--shell-timeout"]))
@@ -44,7 +44,7 @@ def get_power_status(conn, options):
return status.lower().strip()
def set_power_status(conn, options):
- node_cmd = "system:blade\[" + options["--plug"] + "\]>"
+ node_cmd = r"system:blade\[" + options["--plug"] + r"\]>"
conn.send_eol("env -T system:blade[" + options["--plug"] + "]")
i = conn.log_expect(options, [ node_cmd, "system>" ] , int(options["--shell-timeout"]))
@@ -71,7 +71,7 @@ def get_blades_list(conn, options):
conn.log_expect(options, node_cmd, int(options["--shell-timeout"]))
lines = conn.before.split("\r\n")
- filter_re = re.compile("^\s*blade\[(\d+)\]\s+(.*?)\s*$")
+ filter_re = re.compile(r"^\s*blade\[(\d+)\]\s+(.*?)\s*$")
for blade_line in lines:
res = filter_re.search(blade_line)
if res != None:
diff --git a/fence/agents/brocade/fence_brocade.py b/fence/agents/brocade/fence_brocade.py
index 2deab5b..c6b2bfc 100644
--- a/fence/agents/brocade/fence_brocade.py
+++ b/fence/agents/brocade/fence_brocade.py
@@ -17,7 +17,7 @@ def get_power_status(conn, options):
conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
- show_re = re.compile('^\s*Persistent Disable\s*(ON|OFF)\s*$', re.IGNORECASE)
+ show_re = re.compile(r'^\s*Persistent Disable\s*(ON|OFF)\s*$', re.IGNORECASE)
lines = conn.before.split("\n")
for x in lines:
diff --git a/fence/agents/cisco_mds/fence_cisco_mds.py b/fence/agents/cisco_mds/fence_cisco_mds.py
index 6af1e99..dc6c41b 100644
--- a/fence/agents/cisco_mds/fence_cisco_mds.py
+++ b/fence/agents/cisco_mds/fence_cisco_mds.py
@@ -37,7 +37,7 @@ PORT_OID = ""
def cisco_port2oid(port):
port = port.lower()
- nums = re.match('^fc(\d+)/(\d+)$', port)
+ nums = re.match(r'^fc(\d+)/(\d+)$', port)
if ((nums) and (len(nums.groups()))==2):
return "%s.%d.%d"% (PORT_ADMIN_STATUS_OID, int(nums.group(1))+21, int(nums.group(2))-1)
@@ -62,7 +62,7 @@ def get_outlets_status(conn, options):
res_fc = conn.walk(PORTS_OID, 30)
res_aliases = array_to_dict(conn.walk(ALIASES_OID, 30))
- fc_re = re.compile('^"fc\d+/\d+"$')
+ fc_re = re.compile(r'^"fc\d+/\d+"$')
for x in res_fc:
if fc_re.match(x[1]):
diff --git a/fence/agents/drac/fence_drac.py b/fence/agents/drac/fence_drac.py
index ba08ee7..396f09e 100644
--- a/fence/agents/drac/fence_drac.py
+++ b/fence/agents/drac/fence_drac.py
@@ -14,7 +14,7 @@ BUILD_DATE=""
def get_power_status(conn, options):
conn.send_eol("getmodinfo")
conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
- status = re.compile("\s+(on|off)\s+", re.IGNORECASE).search(conn.before).group(1)
+ status = re.compile(r"\s+(on|off)\s+", re.IGNORECASE).search(conn.before).group(1)
return (status.lower().strip())
def set_power_status(conn, options):
diff --git a/fence/agents/drac5/fence_drac5.py b/fence/agents/drac5/fence_drac5.py
index 642dcda..cdf4f4f 100644
--- a/fence/agents/drac5/fence_drac5.py
+++ b/fence/agents/drac5/fence_drac5.py
@@ -35,7 +35,7 @@ def get_power_status(conn, options):
conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
- status = re.compile("(^|: )(ON|OFF|Powering ON|Powering OFF)\s*$",
+ status = re.compile(r"(^|: )(ON|OFF|Powering ON|Powering OFF)\s*$",
re.IGNORECASE | re.MULTILINE).search(conn.before).group(2)
if status.lower().strip() in ["on", "powering on", "powering off"]:
@@ -70,7 +70,7 @@ def get_list_devices(conn, options):
if options["--drac-version"] == "DRAC CMC":
conn.send_eol("getmodinfo")
- list_re = re.compile("^([^\s]*?)\s+Present\s*(ON|OFF)\s*.*$")
+ list_re = re.compile(r"^([^\s]*?)\s+Present\s*(ON|OFF)\s*.*$")
conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
for line in conn.before.splitlines():
if (list_re.search(line)):
@@ -78,7 +78,7 @@ def get_list_devices(conn, options):
elif options["--drac-version"] == "DRAC MC":
conn.send_eol("getmodinfo")
- list_re = re.compile("^\s*([^\s]*)\s*---->\s*(.*?)\s+Present\s*(ON|OFF)\s*.*$")
+ list_re = re.compile(r"^\s*([^\s]*)\s*---->\s*(.*?)\s+Present\s*(ON|OFF)\s*.*$")
conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
for line in conn.before.splitlines():
if (list_re.search(line)):
@@ -110,7 +110,7 @@ def main():
define_new_opts()
- all_opt["cmd_prompt"]["default"] = [ "\$", "DRAC\/MC:" ]
+ all_opt["cmd_prompt"]["default"] = [ r"\$", r"DRAC\/MC:" ]
options = check_input(device_opt, process_input(device_opt))
diff --git a/fence/agents/eps/fence_eps.py b/fence/agents/eps/fence_eps.py
index eaf10d9..dbf5e5b 100644
--- a/fence/agents/eps/fence_eps.py
+++ b/fence/agents/eps/fence_eps.py
@@ -66,7 +66,7 @@ def get_power_status(conn, options):
ret_val = eps_run_command(options,"")
result = {}
- status = re.findall("p(\d{2})=(0|1)\s*\<br\>", ret_val.lower())
+ status = re.findall(r"p(\d{2})=(0|1)\s*\<br\>", ret_val.lower())
for out_num, out_stat in status:
result[out_num] = ("",(out_stat=="1" and "on" or "off"))
diff --git a/fence/agents/hds_cb/fence_hds_cb.py b/fence/agents/hds_cb/fence_hds_cb.py
index 78754fc..70ca185 100755
--- a/fence/agents/hds_cb/fence_hds_cb.py
+++ b/fence/agents/hds_cb/fence_hds_cb.py
@@ -21,7 +21,7 @@ REDHAT_COPYRIGHT=""
BUILD_DATE="November, 2012"
#END_VERSION_GENERATION
-RE_STATUS_LINE = "^([0-9]+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+).*$"
+RE_STATUS_LINE = r"^([0-9]+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+).*$"
def get_power_status(conn, options):
#### Maybe should put a conn.log_expect here to make sure
@@ -113,7 +113,7 @@ def main():
atexit.register(atexit_handler)
all_opt["power_wait"]["default"] = "5"
- all_opt["cmd_prompt"]["default"] = [ "\) :" ]
+ all_opt["cmd_prompt"]["default"] = [ r"\) :" ]
options = check_input(device_opt, process_input(device_opt))
diff --git a/fence/agents/hpblade/fence_hpblade.py b/fence/agents/hpblade/fence_hpblade.py
index 44032d3..6b883db 100644
--- a/fence/agents/hpblade/fence_hpblade.py
+++ b/fence/agents/hpblade/fence_hpblade.py
@@ -22,7 +22,7 @@ def get_power_status(conn, options):
conn.send_eol("show server status " + options["--plug"])
conn.log_expect(options, options["--command-prompt"] , int(options["--shell-timeout"]))
- power_re = re.compile("^\s*Power: (.*?)\s*$")
+ power_re = re.compile(r"^\s*Power: (.*?)\s*$")
status = "unknown"
for line in conn.before.splitlines():
res = power_re.search(line)
@@ -50,7 +50,7 @@ def get_blades_list(conn, options):
conn.send_eol("show server list" )
conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
- list_re = re.compile("^\s*(.*?)\s+(.*?)\s+(.*?)\s+OK\s+(.*?)\s+(.*?)\s*$")
+ list_re = re.compile(r"^\s*(.*?)\s+(.*?)\s+(.*?)\s+OK\s+(.*?)\s+(.*?)\s*$")
for line in conn.before.splitlines():
res = list_re.search(line)
if res != None:
diff --git a/fence/agents/ilo/fence_ilo.py b/fence/agents/ilo/fence_ilo.py
index 8171958..8719573 100644
--- a/fence/agents/ilo/fence_ilo.py
+++ b/fence/agents/ilo/fence_ilo.py
@@ -109,11 +109,11 @@ the iLO card through an XML stream."
if options["--ribcl-version"] >= 2:
conn.send("<RIB_INFO MODE=\"read\"><GET_FW_VERSION />\r\n")
conn.send("</RIB_INFO>\r\n")
- conn.log_expect(options, "<GET_FW_VERSION\s*\n", int(options["--shell-timeout"]))
+ conn.log_expect(options, r"<GET_FW_VERSION\s*\n", int(options["--shell-timeout"]))
conn.log_expect(options, "/>", int(options["--shell-timeout"]))
- options["fw_version"] = float(re.compile("FIRMWARE_VERSION\s*=\s*\"(.*?)\"",
+ options["fw_version"] = float(re.compile(r"FIRMWARE_VERSION\s*=\s*\"(.*?)\"",
re.IGNORECASE).search(conn.before).group(1))
- options["fw_processor"] = re.compile("MANAGEMENT_PROCESSOR\s*=\s*\"(.*?)\"",
+ options["fw_processor"] = re.compile(r"MANAGEMENT_PROCESSOR\s*=\s*\"(.*?)\"",
re.IGNORECASE).search(conn.before).group(1)
conn.send("</LOGIN>\r\n")
except pexpect.TIMEOUT:
diff --git a/fence/agents/ldom/fence_ldom.py b/fence/agents/ldom/fence_ldom.py
index ffa8fe4..7545eed 100644
--- a/fence/agents/ldom/fence_ldom.py
+++ b/fence/agents/ldom/fence_ldom.py
@@ -19,7 +19,7 @@ REDHAT_COPYRIGHT=""
BUILD_DATE=""
#END_VERSION_GENERATION
-COMMAND_PROMPT_REG = "\[PEXPECT\]$"
+COMMAND_PROMPT_REG = r"\[PEXPECT\]$"
COMMAND_PROMPT_NEW = "[PEXPECT]"
# Start comunicating after login. Prepare good environment.
@@ -44,7 +44,7 @@ def get_power_status(conn, options):
fa_status = 0
for line in conn.before.splitlines():
- domain = re.search("^(\S+)\s+(\S+)\s+.*$", line)
+ domain = re.search(r"^(\S+)\s+(\S+)\s+.*$", line)
if (domain!=None):
if ((fa_status==0) and (domain.group(1)=="NAME") and (domain.group(2)=="STATE")):
@@ -75,7 +75,7 @@ def main():
atexit.register(atexit_handler)
all_opt["secure"]["default"] = "1"
- all_opt["cmd_prompt"]["default"] = [ "\ $" ]
+ all_opt["cmd_prompt"]["default"] = [ r"\ $" ]
options = check_input(device_opt, process_input(device_opt))
diff --git a/fence/agents/lib/check_used_options.py b/fence/agents/lib/check_used_options.py
index 2d2abbc..92a2ae6 100755
--- a/fence/agents/lib/check_used_options.py
+++ b/fence/agents/lib/check_used_options.py
@@ -25,8 +25,8 @@ def main():
## all_opt defined in fence agent are found
agent_file = open(agent)
- opt_re = re.compile("\s*all_opt\[\"([^\"]*)\"\] = {")
- opt_longopt_re = re.compile("\s*\"longopt\" : \"([^\"]*)\"")
+ opt_re = re.compile(r"\s*all_opt\[\"([^\"]*)\"\] = {")
+ opt_longopt_re = re.compile(r"\s*\"longopt\" : \"([^\"]*)\"")
in_opt = False
for line in agent_file:
@@ -38,8 +38,8 @@ def main():
## check if all options are defined
agent_file = open(agent)
- option_use_re = re.compile("options\[\"(-[^\"]*)\"\]")
- option_has_re = re.compile("options.has_key\(\"(-[^\"]*)\"\)")
+ option_use_re = re.compile(r"options\[\"(-[^\"]*)\"\]")
+ option_has_re = re.compile(r"options.has_key\(\"(-[^\"]*)\"\)")
counter = 0
without_errors = True
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index a82c30b..a5f9ecf 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -494,7 +494,7 @@ def metadata(avail_opt, options, docs):
mixed = all_opt[option]["help"]
## split it between option and help text
- res = re.compile("^(.*--\S+)\s+", re.IGNORECASE | re.S).search(mixed)
+ res = re.compile(r"^(.*--\S+)\s+", re.IGNORECASE | re.S).search(mixed)
if (None != res):
mixed = res.group(1)
mixed = mixed.replace("<", "<").replace(">", ">")
@@ -953,7 +953,7 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
return result
-def fence_login(options, re_login_string = "(login\s*: )|(Login Name: )|(username: )|(User Name :)"):
+def fence_login(options, re_login_string = r"(login\s*: )|(Login Name: )|(username: )|(User Name :)"):
force_ipvx = ""
if (options.has_key("--inet6-only")):
diff --git a/fence/agents/lpar/fence_lpar.py b/fence/agents/lpar/fence_lpar.py
index 4278650..630b2ca 100644
--- a/fence/agents/lpar/fence_lpar.py
+++ b/fence/agents/lpar/fence_lpar.py
@@ -131,7 +131,7 @@ def main():
all_opt["login_timeout"]["default"] = "15"
all_opt["secure"]["default"] = "1"
- all_opt["cmd_prompt"]["default"] = [ ":~>", "]\$", "\$ " ]
+ all_opt["cmd_prompt"]["default"] = [ r":~>", r"]\$", r"\$ " ]
options = check_input(device_opt, process_input(device_opt))
diff --git a/fence/agents/rsb/fence_rsb.py b/fence/agents/rsb/fence_rsb.py
index 89fb304..af3a2e4 100755
--- a/fence/agents/rsb/fence_rsb.py
+++ b/fence/agents/rsb/fence_rsb.py
@@ -14,7 +14,7 @@ BUILD_DATE=""
def get_power_status(conn, options):
conn.send("2")
conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
- status = re.compile("Power Status[\s]*: (on|off)", re.IGNORECASE).search(conn.before).group(1)
+ status = re.compile(r"Power Status[\s]*: (on|off)", re.IGNORECASE).search(conn.before).group(1)
conn.send("0")
conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
diff --git a/fence/agents/sanbox2/fence_sanbox2.py b/fence/agents/sanbox2/fence_sanbox2.py
index 88814f2..e2c944b 100644
--- a/fence/agents/sanbox2/fence_sanbox2.py
+++ b/fence/agents/sanbox2/fence_sanbox2.py
@@ -38,7 +38,7 @@ def get_power_status(conn, options):
pass
fail(EC_TIMED_OUT)
- status = re.compile(".*AdminState\s+(online|offline)\s+",
+ status = re.compile(r".*AdminState\s+(online|offline)\s+",
re.IGNORECASE | re.MULTILINE).search(conn.before).group(1)
try:
@@ -83,7 +83,7 @@ def get_list_devices(conn, options):
conn.send_eol("show port")
conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
- list_re = re.compile("^\s+(\d+?)\s+(Online|Offline)\s+", re.IGNORECASE)
+ list_re = re.compile(r"^\s+(\d+?)\s+(Online|Offline)\s+", re.IGNORECASE)
for line in conn.before.splitlines():
if (list_re.search(line)):
status = {
@@ -130,7 +130,7 @@ because the connection will block any necessary fencing actions."
conn.send_eol("admin start")
conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
- if (re.search("\(admin\)", conn.before, re.MULTILINE) == None):
+ if (re.search(r"\(admin\)", conn.before, re.MULTILINE) == None):
## Someone else is in admin section, we can't enable/disable
## ports so we will rather exit
logging.error("Failed: Unable to switch to admin section\n")
diff --git a/fence/agents/virsh/fence_virsh.py b/fence/agents/virsh/fence_virsh.py
index fa6993e..f03ea74 100644
--- a/fence/agents/virsh/fence_virsh.py
+++ b/fence/agents/virsh/fence_virsh.py
@@ -36,7 +36,7 @@ def get_outlets_status(conn, options):
fa_status = 0
for line in conn.before.splitlines():
- domain = re.search("^\s*(\S+)\s+(\S+)\s+(\S+).*$", line)
+ domain = re.search(r"^\s*(\S+)\s+(\S+)\s+(\S+).*$", line)
if (domain!=None):
if ((fa_status==0) and (domain.group(1).lower()=="id") and (domain.group(2).lower()=="name")):
diff --git a/fence/agents/vmware/fence_vmware.py b/fence/agents/vmware/fence_vmware.py
index 831142e..79f58b1 100644
--- a/fence/agents/vmware/fence_vmware.py
+++ b/fence/agents/vmware/fence_vmware.py
@@ -248,7 +248,7 @@ def set_power_status(conn, options):
# Returns True, if user uses supported vmrun version (currently >=2.0.0) otherwise False.
def vmware_is_supported_vmrun_version(options):
vmware_help_str = vmware_run_command(options, False, "", 0)
- version_re = re.search("vmrun version (\d\.(\d[\.]*)*)", vmware_help_str.lower())
+ version_re = re.search(r"vmrun version (\d\.(\d[\.]*)*)", vmware_help_str.lower())
if (version_re==None):
return False # Looks like this "vmrun" is not real vmrun
10 years, 2 months