public inbox for cluster-cvs@sourceware.org help / color / mirror / Atom feed
From: mgrac@sourceware.org To: cluster-cvs@sources.redhat.com, cluster-devel@redhat.com Subject: Cluster Project branch, RHEL5, updated. cmirror_1_1_15-90-gd9538c7 Date: Tue, 20 May 2008 09:26:00 -0000 [thread overview] Message-ID: <20080520092627.7871.qmail@sourceware.org> (raw) This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=d9538c73f6450c84b65f6d04e0bc7bcdaa2b7c8b The branch, RHEL5 has been updated via d9538c73f6450c84b65f6d04e0bc7bcdaa2b7c8b (commit) from 1f8a70aafaa307b565335652b530e72ace8176a9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d9538c73f6450c84b65f6d04e0bc7bcdaa2b7c8b Author: Marek 'marx' Grac <mgrac@redhat.com> Date: Tue May 20 11:11:23 2008 +0200 [FENCE] Fix #446995: Parse error: Unknown option 'switch=3' Support for APC MasterSwitch was added (it worked in original fencing agent). Option 'switch' on STDIN didn't have a getopt alternative, so '-s <switch-id>' was added. Plug number notation <switch>:<plug> works as before. Original behaviour for missing switch number does not change. If there is just one MasterSwitch then we will set it up otherwise error is returned. ----------------------------------------------------------------------- Summary of changes: fence/agents/apc/fence_apc.py | 85 ++++++++++++++++++++++++++++++--------- fence/agents/lib/fencing.py.py | 4 ++ 2 files changed, 69 insertions(+), 20 deletions(-) diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py index 5bf74bc..bc1c69c 100755 --- a/fence/agents/apc/fence_apc.py +++ b/fence/agents/apc/fence_apc.py @@ -9,6 +9,7 @@ ## +---------------------------------------------+ ## AP7951 AOS v2.7.0, PDU APP v2.7.3 ## AP7941 AOS v3.5.7, PDU APP v3.5.6 +## AP9606 AOS v2.5.4, PDU APP v2.7.3 ## ## @note: ssh is very slow on AP7951 device ##### @@ -31,6 +32,16 @@ def get_power_status(conn, options): version = 0 admin = 0 + switch = 0; + + if (None != re.compile('.* MasterSwitch plus.*', re.IGNORECASE | re.S).match(conn.before)): + switch = 1; + if (None != re.compile('.* MasterSwitch plus 2', re.IGNORECASE | re.S).match(conn.before)): + if (0 == options.has_key("-s")): + fail_usage("Failed: You have to enter physical switch number") + else: + if (0 == options.has_key("-s")): + options["-s"] = 1 if (None == re.compile('.*Outlet Management.*', re.IGNORECASE | re.S).match(conn.before)): version = 2 @@ -42,16 +53,19 @@ def get_power_status(conn, options): else: admin = 1 - if version == 2: - if admin == 0: - conn.send("2\r\n") + if switch == 0: + if version == 2: + if admin == 0: + conn.send("2\r\n") + else: + conn.send("3\r\n") else: - conn.send("3\r\n") + conn.send("2\r\n") + conn.log_expect(options, options["-c"], SHELL_TIMEOUT) + conn.send("1\r\n") else: - conn.send("2\r\n") - conn.log_expect(options, options["-c"], SHELL_TIMEOUT) - conn.send("1\r\n") - + conn.send(options["-s"]+"\r\n") + while 1 == conn.log_expect(options, [ options["-c"], "Press <ENTER>" ], SHELL_TIMEOUT): result += conn.before conn.send("\r\n") @@ -79,6 +93,22 @@ def set_power_status(conn, options): version = 0 admin = 0 + switch = 0 + + if (None != re.compile('.* MasterSwitch plus.*', re.IGNORECASE | re.S).match(conn.before)): + switch = 1; + ## MasterSwitch has different schema for on/off actions + action = { + 'on' : "1", + 'off': "3" + }[options["-o"]] + if (None != re.compile('.* MasterSwitch plus 2', re.IGNORECASE | re.S).match(conn.before)): + if (0 == options.has_key("-s")): + fail_usage("Failed: You have to enter physical switch number") + else: + if (0 == options.has_key("-s")): + options["-s"] = 1 + if (None == re.compile('.*Outlet Management.*', re.IGNORECASE | re.S).match(conn.before)): version = 2 else: @@ -89,26 +119,35 @@ def set_power_status(conn, options): else: admin = 1 - if version == 2: - if admin == 0: - conn.send("2\r\n") + if switch == 0: + if version == 2: + if admin == 0: + conn.send("2\r\n") + else: + conn.send("3\r\n") else: - conn.send("3\r\n") + conn.send("2\r\n") + conn.log_expect(options, options["-c"], SHELL_TIMEOUT) + conn.send("1\r\n") else: - conn.send("2\r\n") - conn.log_expect(options, options["-c"], SHELL_TIMEOUT) - conn.send("1\r\n") + conn.send(options["-s"] + "\r\n") while 1 == conn.log_expect(options, [ options["-c"], "Press <ENTER>" ], SHELL_TIMEOUT): conn.send("\r\n") conn.send(options["-n"]+"\r\n") conn.log_expect(options, options["-c"], SHELL_TIMEOUT) - if admin == 1: - conn.send("1\r\n") - conn.log_expect(options, options["-c"], SHELL_TIMEOUT) - if version == 3: + + if switch == 0: + if admin == 1: + conn.send("1\r\n") + conn.log_expect(options, options["-c"], SHELL_TIMEOUT) + if version == 3: + conn.send("1\r\n") + conn.log_expect(options, options["-c"], SHELL_TIMEOUT) + else: conn.send("1\r\n") conn.log_expect(options, options["-c"], SHELL_TIMEOUT) + conn.send(action+"\r\n") conn.log_expect(options, "Enter 'YES' to continue or <ENTER> to cancel :", SHELL_TIMEOUT) conn.send("YES\r\n") @@ -126,7 +165,7 @@ def set_power_status(conn, options): def main(): device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug", "action", "ipaddr", "login", "passwd", "passwd_script", - "secure", "port", "test" ] + "secure", "port", "switch", "test" ] options = check_input(device_opt, process_input(device_opt)) @@ -136,6 +175,12 @@ def main(): if 0 == options.has_key("-c"): options["-c"] = "\n>" + ## Support for -n [switch]:[plug] notation that was used before + if (-1 != options["-n"].find(":")): + (switch, plug) = options["-n"].split(":", 1) + options["-s"] = switch; + options["-n"] = plug; + ## ## Operate the fencing device #### diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py index 7aa8a0c..4f13a55 100644 --- a/fence/agents/lib/fencing.py.py +++ b/fence/agents/lib/fencing.py.py @@ -106,6 +106,10 @@ all_opt = { "getopt" : "n:", "help" : "-n <id> Physical plug number on device", "order" : 1 }, + "switch" : { + "getopt" : "-s:", + "help" : "-s <id> Physical switch number on device", + "order" : 1 }, "test" : { "getopt" : "T", "help" : "", hooks/post-receive -- Cluster Project
reply other threads:[~2008-05-20 9:26 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20080520092627.7871.qmail@sourceware.org \ --to=mgrac@sourceware.org \ --cc=cluster-cvs@sources.redhat.com \ --cc=cluster-devel@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).