Gitweb:
http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=af5da5...
Commit: af5da579e90acb9c70ad0f97eff42cd14fd708b5
Parent: d26ddc7daa4b1e1d85374d7bf557f01075e5073d
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Thu Nov 8 10:27:49 2012 +0100
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Thu Nov 8 10:36:34 2012 +0100
fence_hds_cb: Port fence agent to longopts
---
fence/agents/hds_cb/fence_hds_cb.py | 42 +++++++++++++++++-----------------
1 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/fence/agents/hds_cb/fence_hds_cb.py b/fence/agents/hds_cb/fence_hds_cb.py
index 859f255..1f944b3 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["-Y"]))
+ conn.log_expect(options, "SVP>",
int(options["--shell-timeout"]))
conn.sendline("PC") # Enter partition control
- conn.log_expect(options, options["-c"], int(options["-Y"]))
+ conn.log_expect(options, 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:
@@ -41,7 +41,7 @@ def get_power_status(conn, options):
partition = re.search(RE_STATUS_LINE, line)
if( partition != None):
# find the blade number defined in args
- if( partition.group(1) == options["-n"] ):
+ if( partition.group(1) == options["--plug"] ):
result = partition.group(2).lower()
# We must make sure we go back to the main menu as the
# status is checked before any fencing operations are
@@ -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["-Y"]))
+ conn.log_expect(options, "SVP>",
int(options["--shell-timeout"]))
conn.sendline("EX") # Back to system console main menu
- conn.log_expect(options, options["-c"], int(options["-Y"]))
+ conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
except pexpect.EOF:
fail(EC_CONNECTION_LOST)
except pexpect.TIMEOUT:
@@ -64,30 +64,30 @@ def set_power_status(conn, options):
'on' : "P",
'off': "F",
'reboot' : "H",
- }[options["-o"]]
+ }[options["--action"]]
try:
conn.sendline("S") # Enter System Command Mode
- conn.log_expect(options, "SVP>", int(options["-Y"]))
+ conn.log_expect(options, "SVP>",
int(options["--shell-timeout"]))
conn.sendline("PC") # Enter partition control
- conn.log_expect(options, options["-c"], int(options["-Y"]))
+ conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
conn.sendline("P") # Enter power control menu
- conn.log_expect(options, options["-c"], int(options["-Y"]))
+ conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
conn.sendline(action) # Execute action from array above
- conn.log_expect(options, options["-c"], int(options["-Y"]))
- conn.sendline(options["-n"]) # Select blade number from args
- conn.log_expect(options, options["-c"], int(options["-Y"]))
+ conn.log_expect(options, 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.sendline("Y") # Confirm action
- conn.log_expect(options, "Hit enter key.", int(options["-Y"]))
+ conn.log_expect(options, "Hit enter key.",
int(options["--shell-timeout"]))
conn.sendline("") # Press the any key
- conn.log_expect(options, options["-c"], int(options["-Y"]))
+ conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
conn.sendline("Q") # Quit back to partition control
- conn.log_expect(options, options["-c"], int(options["-Y"]))
+ conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
conn.sendline("Q") # Quit back to system command mode
- conn.log_expect(options, "SVP>", int(options["-Y"]))
+ conn.log_expect(options, "SVP>",
int(options["--shell-timeout"]))
conn.sendline("EX") # Quit back to system console menu
- conn.log_expect(options, options["-c"], int(options["-Y"]))
+ conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
except pexpect.EOF:
fail(EC_CONNECTION_LOST)
except pexpect.TIMEOUT:
@@ -97,9 +97,9 @@ def get_blades_list(conn, options):
outlets = { }
try:
conn.sendline("S") # Enter System Command Mode
- conn.log_expect(options, "SVP>", int(options["-Y"]))
+ conn.log_expect(options, "SVP>",
int(options["--shell-timeout"]))
conn.sendline("PC") # Enter partition control
- conn.log_expect(options, options["-c"], int(options["-Y"]))
+ conn.log_expect(options, 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"
@@ -110,9 +110,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["-Y"]))
+ conn.log_expect(options, "SVP>",
int(options["--shell-timeout"]))
conn.sendline("EX") # Quit back to system console menu
- conn.log_expect(options, options["-c"], int(options["-Y"]))
+ conn.log_expect(options, options["--command-prompt"],
int(options["--shell-timeout"]))
except pexpect.EOF:
fail(EC_CONNECTION_LOST)
except pexpect.TIMEOUT: