* [Cluster-devel] [PATCH 1/2] fence_wti: Unable to parse output when splitted into several screens
@ 2011-03-16 13:06 Fabio M. Di Nitto
2011-03-16 13:06 ` [Cluster-devel] [PATCH 2/2] fence_wti: Unable to parse output when splitted into several screens (2/2) Fabio M. Di Nitto
2011-03-16 13:58 ` [Cluster-devel] [PATCH 1/2] fence_wti: Unable to parse output when splitted into several screens Lon Hohberger
0 siblings, 2 replies; 4+ messages in thread
From: Fabio M. Di Nitto @ 2011-03-16 13:06 UTC (permalink / raw)
To: cluster-devel.redhat.com
From: Marek 'marx' Grac <mgrac@redhat.com>
Parsing of listing that consists of several screens added.
Resolves: rhbz#678522
---
fence/agents/wti/fence_wti.py | 28 +++++++++++++++++++++++-----
1 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py
index a71852a..d05676b 100644
--- a/fence/agents/wti/fence_wti.py
+++ b/fence/agents/wti/fence_wti.py
@@ -22,9 +22,26 @@ BUILD_DATE="March, 2008"
#END_VERSION_GENERATION
def get_power_status(conn, options):
- try:
+ listing = ""
+
+ try:
+ conn.send("/S"+"\r\n")
+
+ if isinstance(options["-c"], list):
+ re_all = options["-c"]
+ else:
+ re_all = [options["-c"]]
+ re_next = re.compile("Enter: ", re.IGNORECASE)
+ re_all.append(re_next)
+
conn.send("/S"+"\r\n")
- conn.log_expect(options, options["-c"], int(options["-Y"]))
+ result = conn.log_expect(options, re_all, int(options["-Y"]))
+ listing = conn.before
+ if result == (len(re_all) - 1):
+ conn.send("\r\n")
+ conn.log_expect(options, options["-c"], int(options["-Y"]))
+ listing += conn.before
+
except pexpect.EOF:
fail(EC_CONNECTION_LOST)
except pexpect.TIMEOUT:
@@ -32,8 +49,8 @@ def get_power_status(conn, options):
plug_section = 0
outlets = {}
- for line in conn.before.splitlines():
- if (plug_section == 2) and line.find("|") >= 0:
+ for line in listing.splitlines():
+ if (plug_section == 2) and line.find("|") >= 0 and line.startswith("PLUG") == False:
plug_line = [x.strip().lower() for x in line.split("|")]
if len(plug_line) < len(plug_header):
plug_section = -1
@@ -42,7 +59,8 @@ def get_power_status(conn, options):
return plug_line[status_index]
else:
## We already believe that first column contains plug number
- outlets[plug_line[0]] = (plug_line[name_index], plug_line[status_index])
+ if len(plug_line[0]) != 0:
+ outlets[plug_line[0]] = (plug_line[name_index], plug_line[status_index])
elif (plug_section == 1):
plug_section = 2
pass
--
1.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Cluster-devel] [PATCH 2/2] fence_wti: Unable to parse output when splitted into several screens (2/2)
2011-03-16 13:06 [Cluster-devel] [PATCH 1/2] fence_wti: Unable to parse output when splitted into several screens Fabio M. Di Nitto
@ 2011-03-16 13:06 ` Fabio M. Di Nitto
2011-03-16 13:57 ` Lon Hohberger
2011-03-16 13:58 ` [Cluster-devel] [PATCH 1/2] fence_wti: Unable to parse output when splitted into several screens Lon Hohberger
1 sibling, 1 reply; 4+ messages in thread
From: Fabio M. Di Nitto @ 2011-03-16 13:06 UTC (permalink / raw)
To: cluster-devel.redhat.com
From: Marek 'marx' Grac <mgrac@redhat.com>
Minor changes to previous patch. Power ON/OFF now works as expected
Resolves: rhbz#678522
---
fence/agents/wti/fence_wti.py | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py
index d05676b..8caa4c2 100644
--- a/fence/agents/wti/fence_wti.py
+++ b/fence/agents/wti/fence_wti.py
@@ -28,13 +28,12 @@ def get_power_status(conn, options):
conn.send("/S"+"\r\n")
if isinstance(options["-c"], list):
- re_all = options["-c"]
+ re_all = list(options["-c"])
else:
re_all = [options["-c"]]
re_next = re.compile("Enter: ", re.IGNORECASE)
re_all.append(re_next)
- conn.send("/S"+"\r\n")
result = conn.log_expect(options, re_all, int(options["-Y"]))
listing = conn.before
if result == (len(re_all) - 1):
--
1.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Cluster-devel] [PATCH 2/2] fence_wti: Unable to parse output when splitted into several screens (2/2)
2011-03-16 13:06 ` [Cluster-devel] [PATCH 2/2] fence_wti: Unable to parse output when splitted into several screens (2/2) Fabio M. Di Nitto
@ 2011-03-16 13:57 ` Lon Hohberger
0 siblings, 0 replies; 4+ messages in thread
From: Lon Hohberger @ 2011-03-16 13:57 UTC (permalink / raw)
To: cluster-devel.redhat.com
On Wed, Mar 16, 2011 at 02:06:19PM +0100, Fabio M. Di Nitto wrote:
> From: Marek 'marx' Grac <mgrac@redhat.com>
>
> Minor changes to previous patch. Power ON/OFF now works as expected
>
> Resolves: rhbz#678522
> ---
> fence/agents/wti/fence_wti.py | 3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py
> index d05676b..8caa4c2 100644
> --- a/fence/agents/wti/fence_wti.py
> +++ b/fence/agents/wti/fence_wti.py
> @@ -28,13 +28,12 @@ def get_power_status(conn, options):
> conn.send("/S"+"\r\n")
>
> if isinstance(options["-c"], list):
> - re_all = options["-c"]
> + re_all = list(options["-c"])
> else:
> re_all = [options["-c"]]
> re_next = re.compile("Enter: ", re.IGNORECASE)
> re_all.append(re_next)
>
> - conn.send("/S"+"\r\n")
> result = conn.log_expect(options, re_all, int(options["-Y"]))
> listing = conn.before
> if result == (len(re_all) - 1):
Ack
--
Lon Hohberger - Red Hat, Inc.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Cluster-devel] [PATCH 1/2] fence_wti: Unable to parse output when splitted into several screens
2011-03-16 13:06 [Cluster-devel] [PATCH 1/2] fence_wti: Unable to parse output when splitted into several screens Fabio M. Di Nitto
2011-03-16 13:06 ` [Cluster-devel] [PATCH 2/2] fence_wti: Unable to parse output when splitted into several screens (2/2) Fabio M. Di Nitto
@ 2011-03-16 13:58 ` Lon Hohberger
1 sibling, 0 replies; 4+ messages in thread
From: Lon Hohberger @ 2011-03-16 13:58 UTC (permalink / raw)
To: cluster-devel.redhat.com
On Wed, Mar 16, 2011 at 02:06:18PM +0100, Fabio M. Di Nitto wrote:
> From: Marek 'marx' Grac <mgrac@redhat.com>
>
> Parsing of listing that consists of several screens added.
>
ACK
--
Lon Hohberger - Red Hat, Inc.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-03-16 13:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-16 13:06 [Cluster-devel] [PATCH 1/2] fence_wti: Unable to parse output when splitted into several screens Fabio M. Di Nitto
2011-03-16 13:06 ` [Cluster-devel] [PATCH 2/2] fence_wti: Unable to parse output when splitted into several screens (2/2) Fabio M. Di Nitto
2011-03-16 13:57 ` Lon Hohberger
2011-03-16 13:58 ` [Cluster-devel] [PATCH 1/2] fence_wti: Unable to parse output when splitted into several screens Lon Hohberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).