fence-agents: master - fence2rng.xsl: parametrize and make more flexible
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=06f7d2...
Commit: 06f7d26340d8f700dc834e8ce5495bf156e20d2e
Parent: 908d85d56e6d6610e00876f04f0f0c12c22c412c
Author: Jan Pokorný <jpokorny(a)redhat.com>
AuthorDate: Fri Mar 1 11:23:51 2013 +0100
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Wed Mar 6 16:13:36 2013 +0100
fence2rng.xsl: parametrize and make more flexible
The output is 1:1 to the previous version, but it is now easy to change
base indentation level and internally, we use abstract blocks for tags
instead of </> kludge. Also the unused macro-like template is
removed.
Signed-off-by: Jan Pokorný <jpokorny(a)redhat.com>
---
fence/agents/lib/fence2rng.xsl | 171 ++++++++++++++++++++++++++++++++++++----
1 files changed, 156 insertions(+), 15 deletions(-)
diff --git a/fence/agents/lib/fence2rng.xsl b/fence/agents/lib/fence2rng.xsl
index a958de1..432bc89 100644
--- a/fence/agents/lib/fence2rng.xsl
+++ b/fence/agents/lib/fence2rng.xsl
@@ -1,20 +1,161 @@
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-<xsl:output method="text" indent="yes"/>
-<xsl:template name="capitalize">
- <xsl:param name="value"/>
- <xsl:variable name="normalized" select="translate($value, '_abcdefghijklmnopqrstuvwrxyz', '-ABCDEFGHIJKLMNOPQRSTUVWRXYZ')"/>
- <xsl:value-of select="$normalized"/>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output method="text" indent="no"/>
+
+<xsl:param name="init-indent" select="' '"/>
+<xsl:param name="indent" select="' '"/>
+
+
+<!--
+ helpers
+ -->
+
+<xsl:variable name="SP" select="' '"/>
+<xsl:variable name="NL" select="'
'"/>
+<xsl:variable name="Q" select="'"'"/>
+<xsl:variable name="TS" select="'<'"/>
+<xsl:variable name="TSc" select="'</'"/>
+<xsl:variable name="TE" select="'>'"/>
+<xsl:variable name="TEc" select="'/>'"/>
+
+<xsl:template name="comment">
+ <xsl:param name="text" select="''"/>
+ <xsl:param name="indent" select="''"/>
+ <xsl:if test="$indent != 'none'">
+ <xsl:value-of select="concat($init-indent, $indent)"/>
+ </xsl:if>
+ <xsl:value-of select="concat($TS, '!-- ', $text, ' --',$TE)"/>
+</xsl:template>
+
+<xsl:template name="tag-start">
+ <xsl:param name="name"/>
+ <xsl:param name="attrs" select="''"/>
+ <xsl:param name="indent" select="''"/>
+ <xsl:if test="$indent != 'none'">
+ <xsl:value-of select="concat($init-indent, $indent)"/>
+ </xsl:if>
+ <xsl:value-of select="concat($TS, $name)"/>
+ <xsl:if test="$attrs != ''">
+ <xsl:value-of select="concat($SP, $attrs)"/>
+ </xsl:if>
+ <xsl:value-of select="$TE"/>
+</xsl:template>
+
+<xsl:template name="tag-end">
+ <xsl:param name="name"/>
+ <xsl:param name="attrs" select="''"/>
+ <xsl:param name="indent" select="''"/>
+ <xsl:if test="$indent != 'none'">
+ <xsl:value-of select="concat($init-indent, $indent)"/>
+ </xsl:if>
+ <xsl:value-of select="concat($TSc, $name)"/>
+ <xsl:if test="$attrs != ''">
+ <xsl:value-of select="concat($SP, $attrs)"/>
+ </xsl:if>
+ <xsl:value-of select="$TE"/>
</xsl:template>
+
+<xsl:template name="tag-self">
+ <xsl:param name="name"/>
+ <xsl:param name="attrs" select="''"/>
+ <xsl:param name="indent" select="''"/>
+ <xsl:if test="$indent != 'none'">
+ <xsl:value-of select="concat($init-indent, $indent)"/>
+ </xsl:if>
+ <xsl:value-of select="concat($TS, $name)"/>
+ <xsl:if test="$attrs != ''">
+ <xsl:value-of select="concat($SP, $attrs)"/>
+ </xsl:if>
+ <xsl:value-of select="$TEc"/>
+</xsl:template>
+
+
+<!--
+ proceed
+ -->
+
<xsl:template match="/resource-agent">
- <!-- <xsl:value-of select="@name"/> -->
- <group rha:name="<xsl:value-of select="@name"/>" rha:description="<xsl:value-of select="@shortdesc"/>">
- <optional>
- <attribute name="option"/> <!-- deprecated; for compatibility. use "action" -->
- </optional><xsl:for-each select="parameters/parameter">
- <optional>
- <attribute name="<xsl:value-of select="@name"/>" rha:description="<xsl:value-of select="normalize-space(shortdesc)"/>" />
- </optional></xsl:for-each>
- </group>
+ <xsl:value-of select="$NL"/>
+
+ <!-- (comment denoting the fence agent name) -->
+ <xsl:call-template name="comment">
+ <xsl:with-param name="text" select="@name"/>
+ </xsl:call-template>
+ <xsl:value-of select="$NL"/>
+
+ <!-- group rha:name=... rha:description=... (start) -->
+ <xsl:call-template name="tag-start">
+ <xsl:with-param name="name" select="'group'"/>
+ <xsl:with-param name="attrs" select="concat(
+ 'rha:name=', $Q, @name, $Q, $SP,
+ 'rha:description=', $Q, @shortdesc, $Q)"/>
+ </xsl:call-template>
+ <xsl:value-of select="$NL"/>
+
+ <!-- optional (start) -->
+ <xsl:call-template name="tag-start">
+ <xsl:with-param name="name" select="'optional'"/>
+ <xsl:with-param name="indent" select="$indent"/>
+ </xsl:call-template>
+ <xsl:value-of select="$NL"/>
+
+ <!-- attribute name="option" -->
+ <xsl:call-template name="tag-self">
+ <xsl:with-param name="name" select="'attribute'"/>
+ <xsl:with-param name="attrs" select="concat(
+ 'name=', $Q, 'option', $Q)"/>
+ <xsl:with-param name="indent" select="concat($indent, $indent)"/>
+ </xsl:call-template>
+ <xsl:value-of select="$SP"/>
+ <!-- (comment mentioning that "option" is deprecated) -->
+ <xsl:call-template name="comment">
+ <xsl:with-param name="text">
+ <xsl:text>deprecated; for compatibility. use "action"</xsl:text>
+ </xsl:with-param>
+ <xsl:with-param name="indent" select="'none'"/>
+ </xsl:call-template>
+ <xsl:value-of select="$NL"/>
+ <!-- optional (end) -->
+ <xsl:call-template name="tag-end">
+ <xsl:with-param name="name" select="'optional'"/>
+ <xsl:with-param name="indent" select="$indent"/>
+ </xsl:call-template>
+ <xsl:value-of select="$NL"/>
+
+ <xsl:for-each select="parameters/parameter">
+ <!-- optional (start) -->
+ <xsl:call-template name="tag-start">
+ <xsl:with-param name="name" select="'optional'"/>
+ <xsl:with-param name="indent" select="$indent"/>
+ </xsl:call-template>
+ <xsl:value-of select="$NL"/>
+
+ <!-- attribute name=... rha:description=... -->
+ <xsl:call-template name="tag-self">
+ <xsl:with-param name="name" select="'attribute'"/>
+ <xsl:with-param name="attrs" select="concat(
+ 'name=', $Q, @name, $Q, $SP,
+ 'rha:description=', $Q, normalize-space(shortdesc), $Q, $SP)"/>
+ <xsl:with-param name="indent" select="concat($indent, $indent)"/>
+ </xsl:call-template>
+ <xsl:value-of select="$NL"/>
+
+ <!-- optional (end) -->
+ <xsl:call-template name="tag-end">
+ <xsl:with-param name="name" select="'optional'"/>
+ <xsl:with-param name="indent" select="$indent"/>
+ </xsl:call-template>
+ <xsl:value-of select="$NL"/>
+ </xsl:for-each>
+
+ <!-- group rha:name=... rha:description=... (end) -->
+ <xsl:call-template name="tag-end">
+ <xsl:with-param name="name" select="'group'"/>
+ </xsl:call-template>
+ <xsl:value-of select="$NL"/>
+
+ <xsl:value-of select="$NL"/>
</xsl:template>
+
</xsl:stylesheet>
11 years, 2 months
fence-agents: master - lib: remove static metadata from fence.rng.head
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=908d85...
Commit: 908d85d56e6d6610e00876f04f0f0c12c22c412c
Parent: c32708042d19bcb7265696581463fa28221305ce
Author: Jan Pokorný <jpokorny(a)redhat.com>
AuthorDate: Thu Feb 28 22:37:08 2013 +0100
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Wed Mar 6 16:13:29 2013 +0100
lib: remove static metadata from fence.rng.head
Possible as:
- rps10: droped in aa905c0bf7a717648b44069e4a192f7afe0cda61
(4 years back)
- brocade, mcdata, sanbox2, bladecenter, bullpap, ipmilan:
generate metadata natively
- vixel, egenera, xcat: ditto
- na (Node Assassin): metadata enabled by previous commit
Signed-off-by: Jan Pokorný <jpokorny(a)redhat.com>
---
fence/agents/lib/fence.rng.head | 129 ---------------------------------------
1 files changed, 0 insertions(+), 129 deletions(-)
diff --git a/fence/agents/lib/fence.rng.head b/fence/agents/lib/fence.rng.head
index 632bb53..22f4452 100644
--- a/fence/agents/lib/fence.rng.head
+++ b/fence/agents/lib/fence.rng.head
@@ -3,134 +3,5 @@
<optional>
<choice>
<!-- begin specific fence devices -->
- <!-- begin non-generated device definitions -->
- <!-- RPS10 -->
- <group rha:name="fence_rps10" rha:description="RPS10 Serial Switch" >
- <attribute name="device" rha:description="The device the switch
- is connected to on the controlling host."
- rha:sample="/dev/ttys2"/>
- <attribute name="port" rha:description="The switch outlet
- number." rha:sample="2"/>
- </group>
- <!--FIXME: Determine if the following group should exclude
- the auth and lanplus attributes. Those attributes apply only to
- the impilan fence device.-->
- <!-- Brocade, McData, SANBox2, Bladecenter,bullpap, ipmilan -->
- <!-- FIXME split apart and add rha:name hints for
- configuration utilities -->
- <group>
- <attribute name="ipaddr" rha:description="IP address or the name
- of the device." rha:sample="rack007"/>
- <optional>
- <attribute name="login" rha:description="The login name used to
- access the device. " rha:sample="admin"/>
- </optional>
- <optional>
- <attribute name="passwd" rha:description="The password used to
- authenticate the connection to the
- device." rha:sample="pa$$word"/>
- </optional>
- <optional>
- <attribute name="passwd_script" rha:description="The script that
- supplies a password for access to the fence device. Using
- this supersedes the Password parameter." rha:sample=""/>
- </optional>
- <optional>
- <attribute name="auth" rha:description="For IPMI LAN
- only. Authentication Type: none, password,
- md2, or md5" rha:sample=""/>
- </optional>
- <optional>
- <attribute name="lanplus" rha:description="For IPMI LAN only.
- Set value to either True or 1; leave out for false."
- rha:sample="True"/>
- </optional>
- </group>
- <!-- Vixel -->
- <group rha:name="fence_vixel">
- <optional>
- <attribute name="ipaddr" rha:description="IP address or the
- name of the device." rha:sample="10.1.0.1"/>
- </optional>
- <optional>
- <attribute name="passwd" rha:description="The password used to
- authenticate the connection to the
- device." rha:sample="pa$$word"/>
- </optional>
- <optional>
- <attribute name="passwd_script" rha:description="The script
- that supplies a password for access to the
- fence device. Using this supersedes the Password
- parameter." rha:sample=""/>
- </optional>
- </group>
- <!-- Egenera -->
- <!-- FIXME: Note that in the schema web page each is listed as a
- parameter. Likewise for Conga. In addition, Conga shows Ipan
- and pserver parameters. Also, in Conga, the esh parameter is
- an optional ESH path. Presumably those should be attributes in
- the schema. We need more invormation on this. -->
- <group rha:name="fence_egenera">
- <optional>
- <attribute name="cserver" rha:description="The hostname (and
- optionally the username in the form of username@hostname)
- assigned to the device. Refer to the fence_egenera(8) man
- page for more information." rha:sample=""/>
- </optional>
- <optional>
- <attribute name="pserver" rha:description="The pserver to operate on. fence_egenera(8)" />
- </optional>
- <optional>
- <attribute name="lpan" rha:description="The lpan to operate on. fence_egenera(8)" />
- </optional>
- <optional>
- <attribute name="action" rha:description="The action to perform (reboot, off, on, or status). fence_egenera(8)" />
- </optional>
- <optional>
- <attribute name="esh" rha:description="Path to the esh command on the cserver. fence_egenera(8)" />
- </optional>
- <optional>
- <attribute name="user" rha:description="See fence_egenera(8)" />
- </optional>
- <optional>
- <attribute name="delay" rha:description="Wait this many seconds before fencing is started. fence_egenera(8)" />
- </optional>
- </group>
- <!-- FIXME: It appears that xCat is no longer supported. Found no
- fence agents for x Cat in RHEL 5.3. -->
- <!-- xCAT -->
- <group rha:name="fence_xcat">
- <attribute name="rpowerpath" rha:description="" rha:sample=""/>
- </group>
- <group rha:name="fence_na" rha:description="Node Assassin">
- <optional>
- <attribute name="option"/> <!-- deprecated; for compatibility. use "action" -->
- </optional>
- <!-- I don't think I need this yet.
- <optional>
- <attribute name="auth" rha:description="Node Assassin Auth type (password or none)" />
- </optional>
- -->
- <optional>
- <attribute name="ipaddr" rha:description="Node Assassin IP or name to talk to" />
- </optional>
- <optional>
- <attribute name="passwd" rha:description="Password needed to access the Node Assassin(s)" />
- </optional>
- <optional>
- <attribute name="passwd_script" rha:description="Script to retrieve password (not implemented)" />
- </optional>
- <optional>
- <attribute name="login" rha:description="Login name used to log into the Node Assassin(s)" />
- </optional>
- <optional>
- <attribute name="action" rha:description="Operation to perform. Valid operations: on, off, reboot, status, list, release, boot or shutdown" />
- </optional>
- <optional>
- <attribute name="quiet" rha:description="Supress output" />
- </optional>
- </group>
-
- <!-- end non-generated device definitions -->
<!-- begin auto-generated device definitions -->
11 years, 2 months
fence-agents: master - fencing: Install non-fence agents to libexec
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=c32708...
Commit: c32708042d19bcb7265696581463fa28221305ce
Parent: 7e5af386b361bcc913b8e290be85cdae7f51e3ca
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Wed Mar 6 15:11:14 2013 +0100
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Wed Mar 6 15:15:31 2013 +0100
fencing: Install non-fence agents to libexec
Binaries/scripts which are not fence agents should be installed to libexec directory.
---
fence/agents/kdump/Makefile.am | 3 ++-
fence/agents/lib/fencing.py.py | 2 +-
fence/agents/nss_wrapper/Makefile.am | 2 +-
make/fencebuild.mk | 1 +
4 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/fence/agents/kdump/Makefile.am b/fence/agents/kdump/Makefile.am
index bc526c4..26e452c 100644
--- a/fence/agents/kdump/Makefile.am
+++ b/fence/agents/kdump/Makefile.am
@@ -1,6 +1,7 @@
MAINTAINERCLEANFILES = Makefile.in
-sbin_PROGRAMS = fence_kdump fence_kdump_send
+sbin_PROGRAMS = fence_kdump
+libexec_PROGRAMS = fence_kdump_send
noinst_HEADERS = list.h message.h options.h version.h
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 22cf599..1109be6 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -27,7 +27,7 @@ EC_PASSWORD_MISSING = 10
TELNET_PATH = "/usr/bin/telnet"
SSH_PATH = "/usr/bin/ssh"
-SSL_PATH = "@SBINDIR@/fence_nss_wrapper"
+SSL_PATH = "@LIBEXECDIR@/fence_nss_wrapper"
SUDO_PATH = "/usr/bin/sudo"
all_opt = {
diff --git a/fence/agents/nss_wrapper/Makefile.am b/fence/agents/nss_wrapper/Makefile.am
index 5e47f97..16273ed 100644
--- a/fence/agents/nss_wrapper/Makefile.am
+++ b/fence/agents/nss_wrapper/Makefile.am
@@ -1,6 +1,6 @@
MAINTAINERCLEANFILES = Makefile.in
-sbin_PROGRAMS = fence_nss_wrapper
+libexec_PROGRAMS = fence_nss_wrapper
fence_nss_wrapper_CFLAGS = $(nss_CFLAGS) $(nspr_CFLAGS)
diff --git a/make/fencebuild.mk b/make/fencebuild.mk
index 4a75366..e86d03c 100644
--- a/make/fencebuild.mk
+++ b/make/fencebuild.mk
@@ -8,4 +8,5 @@ $(TARGET): $(SRC)
-e 's#@''SNMPBIN@#${SNMPBIN}#g' \
-e 's#@''LOGDIR@#${LOGDIR}#g' \
-e 's#@''SBINDIR@#${sbindir}#g' \
+ -e 's#@''LIBEXECDIR@#${libexecdir}#g' \
> $@
11 years, 2 months
gfs2-utils: master - gfs2-utils build: Enable silent rules by default
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=874f1c26...
Commit: 874f1c26c7398c085bd14fadc2c6b6d524346c92
Parent: 77f7ae84d26f220425d4c9b4db872c4e1e558afd
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Mon Mar 4 15:01:31 2013 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Mon Mar 4 15:44:54 2013 +0000
gfs2-utils build: Enable silent rules by default
This one-liner turns on automake's silent-rules option by default so
that, instead of the whole build commands being printed, we get neat
output like so:
CC fsck_gfs2-rgrepair.o
CC fsck_gfs2-util.o
CCLD fsck.gfs2
This is intended to allow us to spot warnings more easily. The original
behaviour can be turned back on at configure-time with './configure
--disable-silent-rules' or at build time with 'make V=1'
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
configure.ac | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/configure.ac b/configure.ac
index 3ba3b9b..b24fc86 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,6 +4,7 @@
AC_PREREQ([2.63])
AC_INIT([gfs2-utils], [master], [linux-cluster(a)redhat.com])
AM_INIT_AUTOMAKE([-Wno-portability])
+AM_SILENT_RULES([yes])
LT_PREREQ([2.2.6])
LT_INIT
11 years, 2 months
fence-agents: master - testing: Add test for multiple ports feature
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=7e5af3...
Commit: 7e5af386b361bcc913b8e290be85cdae7f51e3ca
Parent: 0097e806545d722270b739f31a754d65994b18c9
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Mar 4 10:21:55 2013 +0100
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Mar 4 10:21:55 2013 +0100
testing: Add test for multiple ports feature
---
tests/test-multi-apc2.py | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/tests/test-multi-apc2.py b/tests/test-multi-apc2.py
new file mode 100755
index 0000000..7ab9754
--- /dev/null
+++ b/tests/test-multi-apc2.py
@@ -0,0 +1,17 @@
+#!/usr/bin/python
+
+from fence_testing import test_action
+
+def main():
+ DEVICE = "devices.d/multi-apc-v2.cfg"
+
+ ACT_STATUS = "actions.d/status.cfg"
+ ACT_ONOFF = "actions.d/power-on-off.cfg"
+ ACT_LIST = "actions.d/list.cfg"
+
+ test_action(DEVICE, ACT_STATUS, "getopt")
+ test_action(DEVICE, ACT_ONOFF, "stdin")
+ test_action(DEVICE, ACT_LIST, "getopt")
+
+if __name__ == "__main__":
+ main()
\ No newline at end of file
11 years, 2 months
fence-agents: master - fencing: Support multiple plugs for actions (e.g. --n 2, 3, 4)
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=0097e8...
Commit: 0097e806545d722270b739f31a754d65994b18c9
Parent: e9e83a7f037709e598b0660ff74e3d096882a5b9
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Feb 25 17:21:50 2013 +0100
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Mon Feb 25 17:21:50 2013 +0100
fencing: Support multiple plugs for actions (e.g. --n 2,3,4)
Previously, if you have a machine with two (or more) power lines you had to
create a configuration in cluster.conf which was quite common a place for
errors. Instead of pure "reboot" you had to use:
1) port 1 off
2) port 2 off
3) port 1 on
4) port 2 on
With this patch you can use 'port 1,2 reboot'.
---
fence/agents/lib/fencing.py.py | 54 ++++++++++++++++++++++++++++++---------
1 files changed, 41 insertions(+), 13 deletions(-)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index cb8af45..22cf599 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -665,13 +665,6 @@ def check_input(device_opt, opt):
options["--action"] = "off"
## automatic detection and set of valid UUID from --plug
- try:
- options["--uuid"] = str(uuid.UUID(options["--plug"]))
- except ValueError:
- pass
- except KeyError:
- pass
-
if (0 == options.has_key("--username")) and device_opt.count("login") and (device_opt.count("no_login") == 0):
fail_usage("Failed: You have to set login name")
@@ -726,12 +719,45 @@ def check_input(device_opt, opt):
def wait_power_status(tn, options, get_power_fn):
for dummy in xrange(int(options["--power-timeout"])):
- if get_power_fn(tn, options) != options["--action"]:
+ if get_multi_power_fn(tn, options, get_power_fn) != options["--action"]:
time.sleep(1)
else:
return 1
return 0
+## Obtain a power status from possibly more than one plug
+## "on" is returned if at least one plug is ON
+######
+def get_multi_power_fn(tn, options, get_power_fn):
+ status = "off"
+
+ for plug in options["--plugs"]:
+ try:
+ options["--uuid"] = str(uuid.UUID(plug))
+ except ValueError:
+ pass
+ except KeyError:
+ pass
+
+ options["--plug"] = plug
+ plug_status = get_power_fn(tn, options)
+ if plug_status == "on":
+ status = plug_status
+
+ return status
+
+def set_multi_power_fn(tn, options, set_power_fn):
+ for plug in options["--plugs"]:
+ try:
+ options["--uuid"] = str(uuid.UUID(plug))
+ except ValueError:
+ pass
+ except KeyError:
+ pass
+ options["--plug"] = plug
+ set_power_fn(tn, options)
+
+
def show_docs(options, docs = None):
device_opt = options["device_opt"]
@@ -759,6 +785,8 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
result = 0
try:
+ options["--plugs"] = options["--plug"].split(",")
+
## Process options that manipulate fencing device
#####
if (options["--action"] == "list") and 0 == options["device_opt"].count("port"):
@@ -779,7 +807,7 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
print o + options["--separator"] + alias
return
- status = get_power_fn(tn, options)
+ status = get_multi_power_fn(tn, options, get_power_fn)
if status != "on" and status != "off":
fail(EC_STATUS)
@@ -790,7 +818,7 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
else:
power_on = False
for _ in range(1, 1 + int(options["--retry-on"])):
- set_power_fn(tn, options)
+ set_multi_power_fn(tn, options, set_power_fn)
time.sleep(int(options["--power-wait"]))
if wait_power_status(tn, options, get_power_fn):
power_on = True
@@ -804,7 +832,7 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
if status == "off":
print "Success: Already OFF"
else:
- set_power_fn(tn, options)
+ set_multi_power_fn(tn, options, set_power_fn)
time.sleep(int(options["--power-wait"]))
if wait_power_status(tn, options, get_power_fn):
print "Success: Powered OFF"
@@ -813,7 +841,7 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
elif options["--action"] == "reboot":
if status != "off":
options["--action"] = "off"
- set_power_fn(tn, options)
+ set_multi_power_fn(tn, options, set_power_fn)
time.sleep(int(options["--power-wait"]))
if wait_power_status(tn, options, get_power_fn) == 0:
fail(EC_WAITING_OFF)
@@ -822,7 +850,7 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
power_on = False
try:
for _ in range(1, 1 + int(options["--retry-on"])):
- set_power_fn(tn, options)
+ set_multi_power_fn(tn, options, set_power_fn)
time.sleep(int(options["--power-wait"]))
if wait_power_status(tn, options, get_power_fn) == 1:
power_on = True
11 years, 2 months