Gitweb:
http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=ea652f...
Commit: ea652f979107bd9f5d7eef00f2652dff07224499
Parent: 7edde18e0de949c7c8b6780b934d3b843749687a
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Wed Dec 3 16:20:22 2014 +0100
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Wed Dec 3 16:20:22 2014 +0100
[refactor] Change definition of log_expect() method
Previously, log_expect definition was:
def log_expect(self, options, pattern, timeout):
but the 'options' where not used anywhere and if we will plan to use it in this
method,
we already have self.opt available. New method definition is:
def log_expect(self, pattern, timeout):
the rest of this large patch is just removing of options as 1st argument of every call
---
fence/agents/alom/fence_alom.py | 4 +-
fence/agents/apc/fence_apc.py | 38 +++++++++++-----------
fence/agents/bladecenter/fence_bladecenter.py | 16 +++++-----
fence/agents/brocade/fence_brocade.py | 4 +-
fence/agents/drac/fence_drac.py | 4 +-
fence/agents/drac5/fence_drac5.py | 12 +++---
fence/agents/hds_cb/fence_hds_cb.py | 36 +++++++++++-----------
fence/agents/hpblade/fence_hpblade.py | 6 ++--
fence/agents/ilo/fence_ilo.py | 8 ++--
fence/agents/ilo_moonshot/fence_ilo_moonshot.py | 4 +-
fence/agents/ilo_mp/fence_ilo_mp.py | 4 +-
fence/agents/ilo_ssh/fence_ilo_ssh.py | 6 ++--
fence/agents/ldom/fence_ldom.py | 6 ++--
fence/agents/lib/fencing.py.py | 32 +++++++++---------
fence/agents/lpar/fence_lpar.py | 12 +++---
fence/agents/netio/fence_netio.py | 10 +++---
fence/agents/raritan/fence_raritan.py | 8 ++--
fence/agents/rsa/fence_rsa.py | 4 +-
fence/agents/rsb/fence_rsb.py | 14 ++++----
fence/agents/sanbox2/fence_sanbox2.py | 10 +++---
fence/agents/virsh/fence_virsh.py | 6 ++--
fence/agents/wti/fence_wti.py | 12 +++---
22 files changed, 128 insertions(+), 128 deletions(-)
diff --git a/fence/agents/alom/fence_alom.py b/fence/agents/alom/fence_alom.py
index 6b0d03d..1e95ac4 100644
--- a/fence/agents/alom/fence_alom.py
+++ b/fence/agents/alom/fence_alom.py
@@ -18,7 +18,7 @@ BUILD_DATE=""
def get_power_status(conn, options):
conn.send_eol("showplatform")
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
status = re.search("standby", conn.before.lower())
result = (status != None and "off" or "on")
@@ -27,7 +27,7 @@ def get_power_status(conn, options):
def set_power_status(conn, options):
cmd_line = (options["--action"] == "on" and "poweron" or
"poweroff -f -y")
conn.send_eol(cmd_line)
- conn.log_expect(options, options["--command-prompt"],
int(options["--power-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--power-timeout"]))
# Get the machine some time between poweron and poweroff
time.sleep(int(options["--power-timeout"]))
diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index d11bd84..3307e4e 100644
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -31,7 +31,7 @@ def get_power_status(conn, options):
outlets = {}
conn.send_eol("1")
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
version = 0
admin = 0
@@ -64,13 +64,13 @@ def get_power_status(conn, options):
conn.send_eol("3")
else:
conn.send_eol("2")
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
conn.send_eol("1")
else:
conn.send_eol(options["--switch"])
while True:
- exp_result = conn.log_expect(options,
+ exp_result = conn.log_expect(
["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*')
@@ -82,8 +82,8 @@ def get_power_status(conn, options):
if exp_result != 0:
break
conn.send(chr(03))
- conn.log_expect(options, "- Logout",
int(options["--shell-timeout"]))
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect("- Logout", int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
if ["list", "monitor"].count(options["--action"]) == 1:
return outlets
@@ -101,7 +101,7 @@ def set_power_status(conn, options):
}[options["--action"]]
conn.send_eol("1")
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
version = 0
admin2 = 0
@@ -140,7 +140,7 @@ def set_power_status(conn, options):
conn.send_eol("3")
else:
conn.send_eol("2")
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
if None == re.compile('.*2- Outlet Restriction.*', re.IGNORECASE |
re.S).match(conn.before):
admin3 = 0
else:
@@ -149,40 +149,40 @@ def set_power_status(conn, options):
else:
conn.send_eol(options["--switch"])
- while 0 == conn.log_expect(options,
+ while 0 == conn.log_expect(
["Press <ENTER>"] + options["--command-prompt"],
int(options["--shell-timeout"])):
conn.send_eol("")
conn.send_eol(options["--plug"]+"")
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
if switch == 0:
if admin2 == 1:
conn.send_eol("1")
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
if admin3 == 1:
conn.send_eol("1")
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
else:
conn.send_eol("1")
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
conn.send_eol(action)
- conn.log_expect(options, "Enter 'YES' to continue or <ENTER> to
cancel :", int(options["--shell-timeout"]))
+ conn.log_expect("Enter 'YES' to continue or <ENTER> to cancel
:", int(options["--shell-timeout"]))
conn.send_eol("YES")
- conn.log_expect(options, "Press <ENTER> to continue...",
int(options["--power-timeout"]))
+ conn.log_expect("Press <ENTER> to continue...",
int(options["--power-timeout"]))
conn.send_eol("")
- conn.log_expect(options, options["--command-prompt"],
int(options["--power-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--power-timeout"]))
conn.send(chr(03))
- conn.log_expect(options, "- Logout",
int(options["--shell-timeout"]))
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect("- Logout", int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
def get_power_status5(conn, options):
outlets = {}
conn.send_eol("olStatus all")
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
lines = conn.before.split("\n")
show_re = re.compile(r'^\s*(\d+): (.*): (On|Off)\s*$', re.IGNORECASE)
@@ -208,7 +208,7 @@ def set_power_status5(conn, options):
}[options["--action"]]
conn.send_eol(action + " " + options["--plug"])
- conn.log_expect(options, options["--command-prompt"],
int(options["--power-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--power-timeout"]))
def main():
device_opt = ["ipaddr", "login", "passwd",
"cmd_prompt", "secure", \
diff --git a/fence/agents/bladecenter/fence_bladecenter.py
b/fence/agents/bladecenter/fence_bladecenter.py
index 314ced3..38604d5 100644
--- a/fence/agents/bladecenter/fence_bladecenter.py
+++ b/fence/agents/bladecenter/fence_bladecenter.py
@@ -28,7 +28,7 @@ def get_power_status(conn, options):
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"]))
+ i = conn.log_expect([node_cmd, "system>"],
int(options["--shell-timeout"]))
if i == 1:
## Given blade number does not exist
if options.has_key("--missing-as-off"):
@@ -36,10 +36,10 @@ def get_power_status(conn, options):
else:
fail(EC_STATUS)
conn.send_eol("power -state")
- conn.log_expect(options, node_cmd, int(options["--shell-timeout"]))
+ conn.log_expect(node_cmd, int(options["--shell-timeout"]))
status = conn.before.splitlines()[-1]
conn.send_eol("env -T system")
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
return status.lower().strip()
@@ -47,7 +47,7 @@ def set_power_status(conn, options):
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"]))
+ i = conn.log_expect([node_cmd, "system>"],
int(options["--shell-timeout"]))
if i == 1:
## Given blade number does not exist
if options.has_key("--missing-as-off"):
@@ -56,9 +56,9 @@ def set_power_status(conn, options):
fail(EC_GENERIC_ERROR)
conn.send_eol("power -"+options["--action"])
- conn.log_expect(options, node_cmd, int(options["--shell-timeout"]))
+ conn.log_expect(node_cmd, int(options["--shell-timeout"]))
conn.send_eol("env -T system")
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
def get_blades_list(conn, options):
outlets = {}
@@ -66,9 +66,9 @@ def get_blades_list(conn, options):
node_cmd = "system>"
conn.send_eol("env -T system")
- conn.log_expect(options, node_cmd, int(options["--shell-timeout"]))
+ conn.log_expect(node_cmd, int(options["--shell-timeout"]))
conn.send_eol("list -l 2")
- conn.log_expect(options, node_cmd, int(options["--shell-timeout"]))
+ conn.log_expect(node_cmd, int(options["--shell-timeout"]))
lines = conn.before.split("\r\n")
filter_re = re.compile(r"^\s*blade\[(\d+)\]\s+(.*?)\s*$")
diff --git a/fence/agents/brocade/fence_brocade.py
b/fence/agents/brocade/fence_brocade.py
index 54c5920..e5a5063 100644
--- a/fence/agents/brocade/fence_brocade.py
+++ b/fence/agents/brocade/fence_brocade.py
@@ -19,7 +19,7 @@ def set_power_status(conn, options):
}[options["--action"]]
conn.send_eol(action + " " + options["--plug"])
- conn.log_expect(options, options["--command-prompt"],
int(options["--power-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--power-timeout"]))
def get_power_status(conn, options):
line_re = re.compile(r'=========', re.IGNORECASE)
@@ -27,7 +27,7 @@ def get_power_status(conn, options):
in_index = False
conn.send_eol("switchshow")
- conn.log_expect(options, options["--command-prompt"],
int(options["--power-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--power-timeout"]))
for line in str(conn.before).split("\n"):
if line_re.search(line):
in_index = True
diff --git a/fence/agents/drac/fence_drac.py b/fence/agents/drac/fence_drac.py
index 4428fb7..2bac539 100644
--- a/fence/agents/drac/fence_drac.py
+++ b/fence/agents/drac/fence_drac.py
@@ -13,7 +13,7 @@ BUILD_DATE=""
def get_power_status(conn, options):
conn.send_eol("getmodinfo")
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
status = re.compile(r"\s+(on|off)\s+",
re.IGNORECASE).search(conn.before).group(1)
return status.lower().strip()
@@ -24,7 +24,7 @@ def set_power_status(conn, options):
}[options["--action"]]
conn.send_eol("serveraction -d 0 " + action)
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
def main():
device_opt = ["ipaddr", "login", "passwd",
"cmd_prompt", "telnet"]
diff --git a/fence/agents/drac5/fence_drac5.py b/fence/agents/drac5/fence_drac5.py
index 0c9ced6..070fe41 100644
--- a/fence/agents/drac5/fence_drac5.py
+++ b/fence/agents/drac5/fence_drac5.py
@@ -33,7 +33,7 @@ def get_power_status(conn, options):
elif options["--drac-version"] == "DRAC 5":
conn.send_eol("racadm serveraction powerstatus")
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
status = re.compile(r"(^|: )(ON|OFF|Powering ON|Powering OFF)\s*$",
re.IGNORECASE | re.MULTILINE).search(conn.before).group(2)
@@ -58,11 +58,11 @@ def set_power_status(conn, options):
## Fix issue with double-enter [CR/LF]
## We need to read two additional command prompts (one from get + one from set command)
- conn.log_expect(options, options["--command-prompt"],
int(options["--power-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--power-timeout"]))
if len(conn.before.strip()) == 0:
options["eol"] = options["eol"][:-1]
- conn.log_expect(options, options["--command-prompt"],
int(options["--power-timeout"]))
- conn.log_expect(options, options["--command-prompt"],
int(options["--power-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--power-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--power-timeout"]))
def get_list_devices(conn, options):
outlets = {}
@@ -71,7 +71,7 @@ def get_list_devices(conn, options):
conn.send_eol("getmodinfo")
list_re = re.compile(r"^([^\s]*?)\s+Present\s*(ON|OFF)\s*.*$")
- conn.log_expect(options, options["--command-prompt"],
int(options["--power-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--power-timeout"]))
for line in conn.before.splitlines():
if list_re.search(line):
outlets[list_re.search(line).group(1)] = ("",
list_re.search(line).group(2))
@@ -79,7 +79,7 @@ def get_list_devices(conn, options):
conn.send_eol("getmodinfo")
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"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--power-timeout"]))
for line in conn.before.splitlines():
if list_re.search(line):
outlets[list_re.search(line).group(2)] = ("",
list_re.search(line).group(3))
diff --git a/fence/agents/hds_cb/fence_hds_cb.py b/fence/agents/hds_cb/fence_hds_cb.py
index b3d725a..5de8e2a 100755
--- a/fence/agents/hds_cb/fence_hds_cb.py
+++ b/fence/agents/hds_cb/fence_hds_cb.py
@@ -27,9 +27,9 @@ def get_power_status(conn, options):
#### Maybe should put a conn.log_expect here to make sure
#### we have properly entered into the main menu
conn.sendline("S") # Enter System Command Mode
- conn.log_expect(options, "SVP>",
int(options["--shell-timeout"]))
+ conn.log_expect("SVP>", int(options["--shell-timeout"]))
conn.sendline("PC") # Enter partition control
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
result = {}
# Status can now be obtained from the output of the PC
# command. Line looks like the following:
@@ -49,9 +49,9 @@ def get_power_status(conn, options):
# the partition control, but the logic is a little cleaner
# this way.
conn.sendline("Q") # Back to system command mode
- conn.log_expect(options, "SVP>",
int(options["--shell-timeout"]))
+ conn.log_expect("SVP>", int(options["--shell-timeout"]))
conn.sendline("EX") # Back to system console main menu
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
return result
@@ -63,33 +63,33 @@ def set_power_status(conn, options):
}[options["--action"]]
conn.sendline("S") # Enter System Command Mode
- conn.log_expect(options, "SVP>",
int(options["--shell-timeout"]))
+ conn.log_expect("SVP>", int(options["--shell-timeout"]))
conn.sendline("PC") # Enter partition control
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
conn.sendline("P") # Enter power control menu
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
conn.sendline(action) # Execute action from array above
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
conn.sendline(options["--plug"]) # Select blade number from args
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
conn.sendline("Y") # Confirm action
- conn.log_expect(options, "Hit enter key.",
int(options["--shell-timeout"]))
+ conn.log_expect("Hit enter key.", int(options["--shell-timeout"]))
conn.sendline("") # Press the any key
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
conn.sendline("Q") # Quit back to partition control
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
conn.sendline("Q") # Quit back to system command mode
- conn.log_expect(options, "SVP>",
int(options["--shell-timeout"]))
+ conn.log_expect("SVP>", int(options["--shell-timeout"]))
conn.sendline("EX") # Quit back to system console menu
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
def get_blades_list(conn, options):
outlets = {}
conn.sendline("S") # Enter System Command Mode
- conn.log_expect(options, "SVP>",
int(options["--shell-timeout"]))
+ conn.log_expect("SVP>", int(options["--shell-timeout"]))
conn.sendline("PC") # Enter partition control
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
# Status can now be obtained from the output of the PC
# command. Line looks like the following:
# "P Power Condition LID lamp Mode Auto power on"
@@ -100,9 +100,9 @@ def get_blades_list(conn, options):
if partition != None:
outlets[partition.group(1)] = (partition.group(2), "")
conn.sendline("Q") # Quit back to system command mode
- conn.log_expect(options, "SVP>",
int(options["--shell-timeout"]))
+ conn.log_expect("SVP>", int(options["--shell-timeout"]))
conn.sendline("EX") # Quit back to system console menu
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
return outlets
diff --git a/fence/agents/hpblade/fence_hpblade.py
b/fence/agents/hpblade/fence_hpblade.py
index 118dd7f..e73a6c3 100644
--- a/fence/agents/hpblade/fence_hpblade.py
+++ b/fence/agents/hpblade/fence_hpblade.py
@@ -20,7 +20,7 @@ BUILD_DATE="March, 2008"
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"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
power_re = re.compile(r"^\s*Power: (.*?)\s*$")
status = "unknown"
@@ -42,13 +42,13 @@ def set_power_status(conn, options):
conn.send_eol("poweron server " + options["--plug"])
elif options["--action"] == "off":
conn.send_eol("poweroff server " + options["--plug"] + "
force")
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
def get_blades_list(conn, options):
outlets = {}
conn.send_eol("show server list")
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
list_re = re.compile(r"^\s*(.*?)\s+(.*?)\s+(.*?)\s+OK\s+(.*?)\s+(.*?)\s*$")
for line in conn.before.splitlines():
diff --git a/fence/agents/ilo/fence_ilo.py b/fence/agents/ilo/fence_ilo.py
index 965aabf..46650bd 100644
--- a/fence/agents/ilo/fence_ilo.py
+++ b/fence/agents/ilo/fence_ilo.py
@@ -29,7 +29,7 @@ def get_power_status(conn, options):
" PASSWORD = " + quoteattr(options["--password"]) +
">\r\n")
conn.send("<SERVER_INFO MODE =
\"read\"><GET_HOST_POWER_STATUS/>\r\n")
conn.send("</SERVER_INFO></LOGIN>\r\n")
- conn.log_expect(options, "HOST_POWER=\"(.*?)\"",
int(options["--power-timeout"]))
+ conn.log_expect("HOST_POWER=\"(.*?)\"",
int(options["--power-timeout"]))
status = conn.match.group(1)
return status.lower().strip()
@@ -94,7 +94,7 @@ the iLO card through an XML stream."
conn = fence_login(options)
try:
conn.send("<?xml version=\"1.0\"?>\r\n")
- conn.log_expect(options, ["</RIBCL>", "<END_RIBCL/>"],
int(options["--login-timeout"]))
+ conn.log_expect(["</RIBCL>", "<END_RIBCL/>"],
int(options["--login-timeout"]))
version = re.compile("<RIBCL VERSION=\"(.*?)\"",
re.IGNORECASE).search(conn.before).group(1)
if not options.has_key("--ribcl-version"):
options["--ribcl-version"] = float(version)
@@ -109,8 +109,8 @@ 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, r"<GET_FW_VERSION\s*\n",
int(options["--shell-timeout"]))
- conn.log_expect(options, "/>",
int(options["--shell-timeout"]))
+ conn.log_expect(r"<GET_FW_VERSION\s*\n",
int(options["--shell-timeout"]))
+ conn.log_expect("/>", int(options["--shell-timeout"]))
options["fw_version"] =
float(re.compile(r"FIRMWARE_VERSION\s*=\s*\"(.*?)\"",
re.IGNORECASE).search(conn.before).group(1))
options["fw_processor"] =
re.compile(r"MANAGEMENT_PROCESSOR\s*=\s*\"(.*?)\"",
diff --git a/fence/agents/ilo_moonshot/fence_ilo_moonshot.py
b/fence/agents/ilo_moonshot/fence_ilo_moonshot.py
index b9b4559..e161ac6 100644
--- a/fence/agents/ilo_moonshot/fence_ilo_moonshot.py
+++ b/fence/agents/ilo_moonshot/fence_ilo_moonshot.py
@@ -14,7 +14,7 @@ BUILD_DATE=""
def get_power_status(conn, options):
conn.send_eol("show node list")
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
nodes = {}
for line in conn.before.splitlines():
@@ -36,7 +36,7 @@ def set_power_status(conn, options):
else:
conn.send_eol("set node power off force %s" % (options["--plug"]))
- conn.log_expect(options, options["--command-prompt"],
int(options["--power-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--power-timeout"]))
return
diff --git a/fence/agents/ilo_mp/fence_ilo_mp.py b/fence/agents/ilo_mp/fence_ilo_mp.py
index 7195bdd..396d1a9 100644
--- a/fence/agents/ilo_mp/fence_ilo_mp.py
+++ b/fence/agents/ilo_mp/fence_ilo_mp.py
@@ -15,7 +15,7 @@ def get_power_status(conn, options):
conn.send_eol("show /system1")
re_state = re.compile('EnabledState=(.*)', re.IGNORECASE)
- conn.log_expect(options, re_state, int(options["--shell-timeout"]))
+ conn.log_expect(re_state, int(options["--shell-timeout"]))
status = conn.match.group(1).lower()
@@ -30,7 +30,7 @@ def set_power_status(conn, options):
else:
conn.send_eol("stop -f /system1")
- conn.log_expect(options, options["--command-prompt"],
int(options["--power-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--power-timeout"]))
return
diff --git a/fence/agents/ilo_ssh/fence_ilo_ssh.py
b/fence/agents/ilo_ssh/fence_ilo_ssh.py
index 7451792..a510b2e 100644
--- a/fence/agents/ilo_ssh/fence_ilo_ssh.py
+++ b/fence/agents/ilo_ssh/fence_ilo_ssh.py
@@ -15,7 +15,7 @@ def get_power_status(conn, options):
conn.send_eol("show /system1")
re_state = re.compile('EnabledState=(.*)', re.IGNORECASE)
- conn.log_expect(options, re_state, int(options["--shell-timeout"]))
+ conn.log_expect(re_state, int(options["--shell-timeout"]))
status = conn.match.group(1).lower()
@@ -30,13 +30,13 @@ def set_power_status(conn, options):
else:
conn.send_eol("power off hard")
- conn.log_expect(options, options["--command-prompt"],
int(options["--power-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--power-timeout"]))
return
def reboot_cycle(conn, options):
conn.send_eol("reset hard /system1")
- conn.log_expect(options, options["--command-prompt"],
int(options["--power-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--power-timeout"]))
return
def main():
diff --git a/fence/agents/ldom/fence_ldom.py b/fence/agents/ldom/fence_ldom.py
index af4e974..27a1a4a 100644
--- a/fence/agents/ldom/fence_ldom.py
+++ b/fence/agents/ldom/fence_ldom.py
@@ -29,14 +29,14 @@ def start_communication(conn, options):
if res == 0:
#CSH stuff
conn.send_eol("set prompt='" + COMMAND_PROMPT_NEW + "'")
- conn.log_expect(options, COMMAND_PROMPT_REG,
int(options["--shell-timeout"]))
+ conn.log_expect(COMMAND_PROMPT_REG, int(options["--shell-timeout"]))
def get_power_status(conn, options):
start_communication(conn, options)
conn.send_eol("ldm ls")
- conn.log_expect(options, COMMAND_PROMPT_REG, int(options["--shell-timeout"]))
+ conn.log_expect(COMMAND_PROMPT_REG, int(options["--shell-timeout"]))
result = {}
@@ -67,7 +67,7 @@ def set_power_status(conn, options):
conn.send_eol(cmd_line)
- conn.log_expect(options, COMMAND_PROMPT_REG, int(options["--power-timeout"]))
+ conn.log_expect(COMMAND_PROMPT_REG, int(options["--power-timeout"]))
def main():
device_opt = ["ipaddr", "login", "passwd",
"cmd_prompt", "secure", "port"]
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index caa3e2d..abf5e37 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -444,7 +444,7 @@ class fspawn(pexpect.spawn):
pexpect.spawn.__init__(self, command)
self.opt = options
- def log_expect(self, options, pattern, timeout):
+ def log_expect(self, pattern, timeout):
result = self.expect(pattern, timeout)
logging.debug("Received: %s", self.before + self.after)
return result
@@ -1057,25 +1057,25 @@ def fence_login(options, re_login_string=r"(login\s*:
)|((?!Last )Login Name: )
if options.has_key("telnet_over_ssh"):
# This is for stupid ssh servers (like ALOM) which behave more like telnet
# (ignore name and display login prompt)
- result = conn.log_expect(options, \
+ result = conn.log_expect( \
[re_login, "Are you sure you want to continue connecting (yes/no)?"],
int(options["--login-timeout"]))
if result == 1:
conn.sendline("yes") # Host identity confirm
- conn.log_expect(options, re_login, int(options["--login-timeout"]))
+ conn.log_expect(re_login, int(options["--login-timeout"]))
conn.sendline(options["--username"])
- conn.log_expect(options, re_pass, int(options["--login-timeout"]))
+ conn.log_expect(re_pass, int(options["--login-timeout"]))
else:
- result = conn.log_expect(options, \
+ result = conn.log_expect( \
["ssword:", "Are you sure you want to continue connecting
(yes/no)?"],
int(options["--login-timeout"]))
if result == 1:
conn.sendline("yes")
- conn.log_expect(options, "ssword:",
int(options["--login-timeout"]))
+ conn.log_expect("ssword:", int(options["--login-timeout"]))
conn.sendline(options["--password"])
- conn.log_expect(options, options["--command-prompt"],
int(options["--login-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--login-timeout"]))
elif options.has_key("--ssh") and
options.has_key("--identity-file"):
command = '%s %s %s@%s -i %s -p %s' % \
(options["--ssh-path"], force_ipvx, options["--username"],
options["--ip"], \
@@ -1085,18 +1085,18 @@ def fence_login(options, re_login_string=r"(login\s*:
)|((?!Last )Login Name: )
conn = fspawn(options, command)
- result = conn.log_expect(options, ["Enter passphrase for key '" +
options["--identity-file"] + "':", \
+ result = conn.log_expect(["Enter passphrase for key '" +
options["--identity-file"] + "':", \
"Are you sure you want to continue connecting (yes/no)?"] + \
options["--command-prompt"], int(options["--login-timeout"]))
if result == 1:
conn.sendline("yes")
- result = conn.log_expect(options,
+ result = conn.log_expect(
["Enter passphrase for key '" +
options["--identity-file"]+"':"] + \
options["--command-prompt"], int(options["--login-timeout"]))
if result == 0:
if options.has_key("--password"):
conn.sendline(options["--password"])
- conn.log_expect(options, options["--command-prompt"],
int(options["--login-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--login-timeout"]))
else:
fail_usage("Failed: You have to enter passphrase (-p) for identity file")
else:
@@ -1104,7 +1104,7 @@ def fence_login(options, re_login_string=r"(login\s*:
)|((?!Last )Login Name: )
conn.send("set binary\n")
conn.send("open %s -%s\n"%(options["--ip"],
options["--ipport"]))
- result = conn.log_expect(options, re_login,
int(options["--login-timeout"]))
+ result = conn.log_expect(re_login, int(options["--login-timeout"]))
conn.send_eol(options["--username"])
## automatically change end of line separator
@@ -1112,13 +1112,13 @@ def fence_login(options, re_login_string=r"(login\s*:
)|((?!Last )Login Name: )
if re_login.search(screen) != None:
options["eol"] = "\n"
conn.send_eol(options["--username"])
- result = conn.log_expect(options, re_pass,
int(options["--login-timeout"]))
+ result = conn.log_expect(re_pass, int(options["--login-timeout"]))
elif re_pass.search(screen) != None:
- conn.log_expect(options, re_pass, int(options["--shell-timeout"]))
+ conn.log_expect(re_pass, int(options["--shell-timeout"]))
try:
conn.send_eol(options["--password"])
- valid_password = conn.log_expect(options, [re_login] + \
+ valid_password = conn.log_expect([re_login] + \
options["--command-prompt"], int(options["--shell-timeout"]))
if valid_password == 0:
## password is invalid or we have to change EOL separator
@@ -1129,9 +1129,9 @@ def fence_login(options, re_login_string=r"(login\s*:
)|((?!Last )Login Name: )
if re_login.search(screen) != None:
conn.send_eol("")
conn.send_eol(options["--username"])
- conn.log_expect(options, re_pass, int(options["--login-timeout"]))
+ conn.log_expect(re_pass, int(options["--login-timeout"]))
conn.send_eol(options["--password"])
- conn.log_expect(options, options["--command-prompt"],
int(options["--login-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--login-timeout"]))
except KeyError:
fail(EC_PASSWORD_MISSING)
except pexpect.EOF:
diff --git a/fence/agents/lpar/fence_lpar.py b/fence/agents/lpar/fence_lpar.py
index 31b0521..caa7d38 100644
--- a/fence/agents/lpar/fence_lpar.py
+++ b/fence/agents/lpar/fence_lpar.py
@@ -25,7 +25,7 @@ BUILD_DATE=""
def get_power_status(conn, options):
if options["--hmc-version"] == "3":
conn.send("lssyscfg -r lpar -m " + options["--managed"] + " -n
" + options["--plug"] + " -F name,state\n")
- conn.log_expect(options, options["--command-prompt"],
int(options["--power-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--power-timeout"]))
try:
status = re.compile("^" + options["--plug"] +
",(.*?),.*$",
@@ -35,7 +35,7 @@ def get_power_status(conn, options):
elif options["--hmc-version"] == "4":
conn.send("lssyscfg -r lpar -m "+ options["--managed"] +
" --filter 'lpar_names=" + options["--plug"] +
"'\n")
- conn.log_expect(options, options["--command-prompt"],
int(options["--power-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--power-timeout"]))
try:
status = re.compile(",state=(.*?),",
re.IGNORECASE).search(conn.before).group(1)
@@ -55,7 +55,7 @@ def set_power_status(conn, options):
if options["--hmc-version"] == "3":
conn.send("chsysstate -o " + options["--action"] + " -r lpar
-m " + options["--managed"]
+ " -n " + options["--plug"] + "\n")
- conn.log_expect(options, options["--command-prompt"],
int(options["--power-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--power-timeout"]))
elif options["--hmc-version"] == "4":
if options["--action"] == "on":
conn.send("chsysstate -o on -r lpar -m " + options["--managed"] +
@@ -66,13 +66,13 @@ def set_power_status(conn, options):
else:
conn.send("chsysstate -o shutdown -r lpar --immed" +
" -m " + options["--managed"] + " -n " +
options["--plug"] + "\n")
- conn.log_expect(options, options["--command-prompt"],
int(options["--power-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--power-timeout"]))
def get_lpar_list(conn, options):
outlets = {}
if options["--hmc-version"] == "3":
conn.send("query_partition_names -m " + options["--managed"] +
"\n")
- conn.log_expect(options, options["--command-prompt"],
int(options["--power-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--power-timeout"]))
## We have to remove first 3 lines (command + header) and last line (part of new
prompt)
####
@@ -87,7 +87,7 @@ def get_lpar_list(conn, options):
elif options["--hmc-version"] == "4":
conn.send("lssyscfg -r lpar -m " + options["--managed"] +
" -F name:state\n")
- conn.log_expect(options, options["--command-prompt"],
int(options["--power-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--power-timeout"]))
## We have to remove first line (command) and last line (part of new prompt)
####
diff --git a/fence/agents/netio/fence_netio.py b/fence/agents/netio/fence_netio.py
index 6f34c92..1a37206 100755
--- a/fence/agents/netio/fence_netio.py
+++ b/fence/agents/netio/fence_netio.py
@@ -15,7 +15,7 @@ BUILD_DATE=""
def get_power_status(conn, options):
conn.send_eol("port %s" % options["--plug"])
re_status = re.compile("250 [01imt]")
- conn.log_expect(options, re_status, int(options["--shell-timeout"]))
+ conn.log_expect(re_status, int(options["--shell-timeout"]))
status = {
"0" : "off",
"1" : "on",
@@ -34,7 +34,7 @@ def set_power_status(conn, options):
}[options["--action"]]
conn.send_eol("port %s %s" % (options["--plug"], action))
- conn.log_expect(options, "250 OK", int(options["--shell-timeout"]))
+ conn.log_expect("250 OK", int(options["--shell-timeout"]))
def get_outlet_list(conn, options):
result = {}
@@ -43,7 +43,7 @@ def get_outlet_list(conn, options):
# the NETIO-230B has 4 ports, counting start at 1
for plug in ["1", "2", "3", "4"]:
conn.send_eol("port setup %s" % plug)
- conn.log_expect(options, "250 .+",
int(options["--shell-timeout"]))
+ conn.log_expect("250 .+", int(options["--shell-timeout"]))
# the name is enclosed in "", drop those with [1:-1]
name = conn.after.split()[1][1:-1]
result[plug] = (name, "unknown")
@@ -87,9 +87,9 @@ block any necessary fencing actions."
conn.send("open %s -%s\n"%(options["--ip"],
options["--ipport"]))
conn.read_nonblocking(size=100, timeout=int(options["--shell-timeout"]))
- conn.log_expect(options, "100 HELLO .*",
int(options["--shell-timeout"]))
+ conn.log_expect("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"]))
+ conn.log_expect("250 OK", int(options["--shell-timeout"]))
except pexpect.EOF:
fail(EC_LOGIN_DENIED)
except pexpect.TIMEOUT:
diff --git a/fence/agents/raritan/fence_raritan.py
b/fence/agents/raritan/fence_raritan.py
index 1d674ad..502742e 100644
--- a/fence/agents/raritan/fence_raritan.py
+++ b/fence/agents/raritan/fence_raritan.py
@@ -18,7 +18,7 @@ BUILD_DATE=""
def get_power_status(conn, options):
conn.send_eol("show -d properties=powerState %s" %
options["--plug"])
re_status = re.compile(".*powerState is [12].*")
- conn.log_expect(options, re_status, int(options["--shell-timeout"]))
+ conn.log_expect(re_status, int(options["--shell-timeout"]))
status = {
#"0" : "off",
"1" : "on",
@@ -69,11 +69,11 @@ block any necessary fencing actions."
conn.send("set binary\n")
conn.send("open %s -%s\n"%(options["--ip"],
options["--ipport"]))
conn.read_nonblocking(size=100, timeout=int(options["--shell-timeout"]))
- conn.log_expect(options, "Login.*",
int(options["--shell-timeout"]))
+ conn.log_expect("Login.*", int(options["--shell-timeout"]))
conn.send_eol("%s" % (options["--username"]))
- conn.log_expect(options, "Password.*",
int(options["--shell-timeout"]))
+ conn.log_expect("Password.*", int(options["--shell-timeout"]))
conn.send_eol("%s" % (options["--password"]))
- conn.log_expect(options, "clp.*", int(options["--shell-timeout"]))
+ conn.log_expect("clp.*", int(options["--shell-timeout"]))
except pexpect.EOF:
fail(EC_LOGIN_DENIED)
except pexpect.TIMEOUT:
diff --git a/fence/agents/rsa/fence_rsa.py b/fence/agents/rsa/fence_rsa.py
index 6bb4989..46f4bb9 100644
--- a/fence/agents/rsa/fence_rsa.py
+++ b/fence/agents/rsa/fence_rsa.py
@@ -20,7 +20,7 @@ BUILD_DATE=""
def get_power_status(conn, options):
conn.send_eol("power state")
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
match = re.compile("Power: (.*)", re.IGNORECASE).search(conn.before)
if match != None:
@@ -32,7 +32,7 @@ def get_power_status(conn, options):
def set_power_status(conn, options):
conn.send_eol("power " + options["--action"])
- conn.log_expect(options, options["--command-prompt"],
int(options["--power-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--power-timeout"]))
def main():
device_opt = ["ipaddr", "login", "passwd",
"cmd_prompt", "secure", "telnet"]
diff --git a/fence/agents/rsb/fence_rsb.py b/fence/agents/rsb/fence_rsb.py
index 0058ac8..73941b6 100755
--- a/fence/agents/rsb/fence_rsb.py
+++ b/fence/agents/rsb/fence_rsb.py
@@ -13,10 +13,10 @@ BUILD_DATE=""
def get_power_status(conn, options):
conn.send("2")
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
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"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
return status.lower().strip()
@@ -27,16 +27,16 @@ def set_power_status(conn, options):
}[options["--action"]]
conn.send("2")
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
conn.send_eol(action)
- conn.log_expect(options, ["want to power " + options["--action"],
+ conn.log_expect(["want to power " + options["--action"],
"yes/no", "'yes' or 'no'"],
int(options["--shell-timeout"]))
conn.send_eol("yes")
- conn.log_expect(options, "any key to continue",
int(options["--power-timeout"]))
+ conn.log_expect("any key to continue",
int(options["--power-timeout"]))
conn.send_eol("")
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
conn.send_eol("0")
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
def main():
device_opt = ["ipaddr", "login", "passwd",
"secure", "cmd_prompt", "telnet"]
diff --git a/fence/agents/sanbox2/fence_sanbox2.py
b/fence/agents/sanbox2/fence_sanbox2.py
index 1a041cf..efa7dc8 100644
--- a/fence/agents/sanbox2/fence_sanbox2.py
+++ b/fence/agents/sanbox2/fence_sanbox2.py
@@ -28,7 +28,7 @@ def get_power_status(conn, options):
}
try:
conn.send_eol("show port " + options["--plug"])
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
except pexpect.TIMEOUT:
try:
conn.send_eol("admin end")
@@ -54,7 +54,7 @@ def set_power_status(conn, options):
try:
conn.send_eol("set port " + options["--plug"] + " state "
+ action)
- conn.log_expect(options, options["--command-prompt"],
int(options["--power-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--power-timeout"]))
except pexpect.TIMEOUT:
try:
conn.send_eol("admin end")
@@ -66,7 +66,7 @@ def set_power_status(conn, options):
try:
conn.send_eol("set port " + options["--plug"] + " state "
+ action)
- conn.log_expect(options, options["--command-prompt"],
int(options["--power-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--power-timeout"]))
except pexpect.TIMEOUT:
try:
conn.send_eol("admin end")
@@ -81,7 +81,7 @@ def get_list_devices(conn, options):
try:
conn.send_eol("show port")
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
list_re = re.compile(r"^\s+(\d+?)\s+(Online|Offline)\s+", re.IGNORECASE)
for line in conn.before.splitlines():
@@ -129,7 +129,7 @@ because the connection will block any necessary fencing
actions."
conn = fence_login(options)
conn.send_eol("admin start")
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
if re.search(r"\(admin\)", conn.before, re.MULTILINE) == None:
## Someone else is in admin section, we can't enable/disable
diff --git a/fence/agents/virsh/fence_virsh.py b/fence/agents/virsh/fence_virsh.py
index b351834..d3dd8fc 100644
--- a/fence/agents/virsh/fence_virsh.py
+++ b/fence/agents/virsh/fence_virsh.py
@@ -28,7 +28,7 @@ def get_outlets_status(conn, options):
prefix = ""
conn.sendline(prefix + "virsh list --all")
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
result = {}
@@ -49,7 +49,7 @@ def get_outlets_status(conn, options):
def get_power_status(conn, options):
prefix = options["--sudo-path"] + " " if
options.has_key("--use-sudo") else ""
conn.sendline(prefix + "virsh domstate %s" % (get_name_or_uuid(options)))
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
for line in conn.before.splitlines():
if line.strip() in ["running", "blocked", "idle",
"no state", "paused"]:
@@ -64,7 +64,7 @@ def set_power_status(conn, options):
conn.sendline(prefix + "virsh %s " %
(options["--action"] == "on" and "start" or
"destroy") + get_name_or_uuid(options))
- conn.log_expect(options, options["--command-prompt"],
int(options["--power-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--power-timeout"]))
time.sleep(int(options["--power-wait"]))
def main():
diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py
index e669f20..f4ab51b 100644
--- a/fence/agents/wti/fence_wti.py
+++ b/fence/agents/wti/fence_wti.py
@@ -36,11 +36,11 @@ def get_listing(conn, options, listing_command):
re_next = re.compile("Enter: ", re.IGNORECASE)
re_all.append(re_next)
- result = conn.log_expect(options, re_all, int(options["--shell-timeout"]))
+ result = conn.log_expect(re_all, int(options["--shell-timeout"]))
listing = conn.before
if result == (len(re_all) - 1):
conn.send_eol("")
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
listing += conn.before
return listing
@@ -175,7 +175,7 @@ def set_power_status(conn, options):
}[options["--action"]]
conn.send_eol(action + " " + options["--plug"] + ",y")
- conn.log_expect(options, options["--command-prompt"],
int(options["--power-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--power-timeout"]))
def main():
device_opt = ["ipaddr", "login", "passwd",
"no_login", "no_password", \
@@ -216,18 +216,18 @@ is running because the connection will block any necessary fencing
actions."
re_login = re.compile("(login: )|(Login Name: )|(username: )|(User Name
:)", re.IGNORECASE)
re_prompt = re.compile("|".join(["(" + x + ")" for x in
options["--command-prompt"]]), re.IGNORECASE)
- result = conn.log_expect(options, [re_login, "Password: ", re_prompt],
int(options["--shell-timeout"]))
+ result = conn.log_expect([re_login, "Password: ", re_prompt],
int(options["--shell-timeout"]))
if result == 0:
if options.has_key("--username"):
conn.send_eol(options["--username"])
- result = conn.log_expect(options, [re_login, "Password: ", re_prompt],
int(options["--shell-timeout"]))
+ result = conn.log_expect([re_login, "Password: ", re_prompt],
int(options["--shell-timeout"]))
else:
fail_usage("Failed: You have to set login name")
if result == 1:
if options.has_key("--password"):
conn.send_eol(options["--password"])
- conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
+ conn.log_expect(options["--command-prompt"],
int(options["--shell-timeout"]))
else:
fail_usage("Failed: You have to enter password or password script")
except pexpect.EOF: