Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=aef329297... Commit: aef3292971598b39f237be8400f41d55e080219a Parent: e0b9090cac46a1010f7b57f7aef9412753a312b6 Author: Marek 'marx' Grac mgrac@redhat.com AuthorDate: Wed Feb 6 13:54:05 2013 +0100 Committer: Marek 'marx' Grac mgrac@redhat.com CommitterDate: Wed Feb 6 13:59:21 2013 +0100
fence_drac5: fix regression on Dell CMC and Dell DRAC5
Standard EOL for agents connecting via ssh is CR/LF.
Some Dell devices represents CR/LF as double-enter what creates a problem in parsing of output.
This patch adds a check for double-enter. This can be detected in function which power on/off machine because 'get power status' was run before and if we can find a line without any command we know that there is a double-enter problem.
Resolves: rhbz#905478 --- fence/agents/drac5/fence_drac5.py | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/fence/agents/drac5/fence_drac5.py b/fence/agents/drac5/fence_drac5.py index 3e9a8d2..7d9082a 100644 --- a/fence/agents/drac5/fence_drac5.py +++ b/fence/agents/drac5/fence_drac5.py @@ -52,7 +52,14 @@ def set_power_status(conn, options): conn.send_eol("racadm serveraction " + action + " -m " + options["-m"]) elif options["model"] == "DRAC 5": conn.send_eol("racadm serveraction " + action) + + ## 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["-c"], int(options["-g"])) + if len(conn.before.strip()) == 0: + options["eol"] = options["eol"][:-1] + conn.log_expect(options, options["-c"], int(options["-g"])) + conn.log_expect(options, options["-c"], int(options["-g"])) except pexpect.EOF: fail(EC_CONNECTION_LOST) except pexpect.TIMEOUT: