fence-agents: RHEL6 - fencing: Validation if password/password_script or identity file is used was not processed
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=2acb7f...
Commit: 2acb7fe7fb97ba27b31f50442dd886be0e929e1b
Parent: 3048ba31835713334b251012ae935e858f62095b
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Fri May 24 16:17:12 2013 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Fri Jun 28 11:09:53 2013 +0200
fencing: Validation if password/password_script or identity file is used was not processed
Resolves: rhbz#959490
---
fence/agents/lib/fencing.py.py | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index cb8ec26..ad5f4db 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -698,9 +698,9 @@ def check_input(device_opt, opt):
if 0 == device_opt.count("identity_file"):
if 0 == (options.has_key("-p") or options.has_key("-S")):
fail_usage("Failed: You have to enter password or password script")
- else:
- if 0 == (options.has_key("-p") or options.has_key("-S") or options.has_key("-k")):
- fail_usage("Failed: You have to enter password, password script or identity file")
+ else:
+ if 0 == (options.has_key("-p") or options.has_key("-S") or options.has_key("-k")):
+ fail_usage("Failed: You have to enter password, password script or identity file")
if 0 == options.has_key("-x") and 1 == options.has_key("-k"):
fail_usage("Failed: You have to use identity file together with ssh connection (-x)")
10 years, 9 months
fence-agents: RHEL6 - fence2rng.xsl: parametrize and make more flexible
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=3048ba...
Commit: 3048ba31835713334b251012ae935e858f62095b
Parent: 4cc3580075dc0e7211837ffd98350224b882bde5
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: Fri Jun 28 11:06:04 2013 +0200
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>
Resolves: rhbz#917675
---
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>
10 years, 9 months
fence-agents: RHEL6 - 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=4cc358...
Commit: 4cc3580075dc0e7211837ffd98350224b882bde5
Parent: e6fcc75af95f56c107786d60e310ce0e0442e940
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: Fri Jun 28 11:05:30 2013 +0200
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
Signed-off-by: Jan Pokorný <jpokorny(a)redhat.com>
Resolves: rhbz#917675
---
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 -->
10 years, 9 months
fence-agents: RHEL6 - fence_cisco_ucs: Incorrect timeout was used during login
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=e6fcc7...
Commit: e6fcc75af95f56c107786d60e310ce0e0442e940
Parent: d0c2a2ec6a553d6341e199592284f180a6824593
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Oct 22 15:51:55 2012 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Fri Jun 28 10:56:44 2013 +0200
fence_cisco_ucs: Incorrect timeout was used during login
Previously, login command was bound with shell_timeout instead of login_timeout.
Resolves: rhbz#978325
---
fence/agents/cisco_ucs/fence_cisco_ucs.py | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/fence/agents/cisco_ucs/fence_cisco_ucs.py b/fence/agents/cisco_ucs/fence_cisco_ucs.py
index 0be06a0..d1d8501 100644
--- a/fence/agents/cisco_ucs/fence_cisco_ucs.py
+++ b/fence/agents/cisco_ucs/fence_cisco_ucs.py
@@ -18,7 +18,7 @@ re_get_desc = re.compile(" descr=\"(.*?)\"", re.IGNORECASE)
def get_power_status(conn, options):
try:
- res = send_command(options, "<configResolveDn cookie=\"" + options["cookie"] + "\" inHierarchical=\"false\" dn=\"org-root" + options["-s"] + "/ls-" + options["-n"] + "/power\"/>")
+ res = send_command(options, "<configResolveDn cookie=\"" + options["cookie"] + "\" inHierarchical=\"false\" dn=\"org-root" + options["-s"] + "/ls-" + options["-n"] + "/power\"/>", int(options["-Y"]))
except pycurl.error, e:
sys.stderr.write(e[1] + "\n")
fail(EC_TIMED_OUT)
@@ -41,7 +41,7 @@ def set_power_status(conn, options):
}[options["-o"]]
try:
- res = send_command(options, "<configConfMos cookie=\"" + options["cookie"] + "\" inHierarchical=\"no\"><inConfigs><pair key=\"org-root" + options["-s"] + "/ls-" + options["-n"] + "/power\"><lsPower dn=\"org-root/ls-" + options["-n"] + "/power\" state=\"" + action + "\" status=\"modified\" /></pair></inConfigs></configConfMos>")
+ res = send_command(options, "<configConfMos cookie=\"" + options["cookie"] + "\" inHierarchical=\"no\"><inConfigs><pair key=\"org-root" + options["-s"] + "/ls-" + options["-n"] + "/power\"><lsPower dn=\"org-root/ls-" + options["-n"] + "/power\" state=\"" + action + "\" status=\"modified\" /></pair></inConfigs></configConfMos>", int(options["-Y"]))
except pycurl.error, e:
sys.stderr.write(e[1] + "\n")
fail(EC_TIMED_OUT)
@@ -53,7 +53,7 @@ def get_list(conn, options):
try:
try:
- res = send_command(options, "<configResolveClass cookie=\"" + options["cookie"] + "\" inHierarchical=\"false\" classId=\"lsServer\"/>")
+ res = send_command(options, "<configResolveClass cookie=\"" + options["cookie"] + "\" inHierarchical=\"false\" classId=\"lsServer\"/>", int(options["-Y"]))
except pycurl.error, e:
sys.stderr.write(e[1] + "\n")
fail(EC_TIMED_OUT)
@@ -70,7 +70,7 @@ def get_list(conn, options):
return outlets
-def send_command(opt, command):
+def send_command(opt, command, timeout):
## setup correct URL
if opt.has_key("-z"):
url = "https:"
@@ -86,7 +86,7 @@ def send_command(opt, command):
c.setopt(pycurl.HTTPHEADER, [ "Content-type: text/xml" ])
c.setopt(pycurl.POSTFIELDS, command)
c.setopt(pycurl.WRITEFUNCTION, b.write)
- c.setopt(pycurl.TIMEOUT, int(opt["-Y"]))
+ c.setopt(pycurl.TIMEOUT, timeout)
c.setopt(pycurl.SSL_VERIFYPEER, 0)
c.setopt(pycurl.SSL_VERIFYHOST, 0)
c.perform()
@@ -146,7 +146,7 @@ used with Cisco UCS to fence machines."
result = fence_action(None, options, set_power_status, get_power_status, get_list)
### Logout; we do not care about result as we will end in any case
- send_command(options, "<aaaLogout inCookie=\"" + options["cookie"] + "\" />")
+ send_command(options, "<aaaLogout inCookie=\"" + options["cookie"] + "\" />", int(options["-Y"]))
sys.exit(result)
10 years, 9 months
fence-agents: RHEL6 - fence_cisco_ucs: Fix traceback when hostname cannot be resolved to IP address
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=d0c2a2...
Commit: d0c2a2ec6a553d6341e199592284f180a6824593
Parent: c399203557e791f7e92e838c948a1b7d5582d7cd
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Wed Feb 6 16:27:01 2013 +0100
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Fri Jun 28 10:52:59 2013 +0200
fence_cisco_ucs: Fix traceback when hostname cannot be resolved to IP address
Resolves: rhbz#978326
---
fence/agents/cisco_ucs/fence_cisco_ucs.py | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/fence/agents/cisco_ucs/fence_cisco_ucs.py b/fence/agents/cisco_ucs/fence_cisco_ucs.py
index 19b2086..0be06a0 100644
--- a/fence/agents/cisco_ucs/fence_cisco_ucs.py
+++ b/fence/agents/cisco_ucs/fence_cisco_ucs.py
@@ -120,13 +120,17 @@ used with Cisco UCS to fence machines."
if options["-o"] in ["off", "reboot"]:
time.sleep(int(options["-f"]))
- res = send_command(options, "<aaaLogin inName=\"" + options["-l"] + "\" inPassword=\"" + options["-p"] + "\" />")
- result = re_cookie.search(res)
- if (result == None):
- ## Cookie is absenting in response
+ try:
+ res = send_command(options, "<aaaLogin inName=\"" + options["-l"] + "\" inPassword=\"" + options["-p"] + "\" />", int(options("-y")))
+
+ result = re_cookie.search(res)
+ if (result == None):
+ ## Cookie is absenting in response
+ fail(EC_LOGIN_DENIED)
+ except:
fail(EC_LOGIN_DENIED)
- options["cookie"] = result.group(1);
+ options["cookie"] = result.group(1)
##
## Modify suborg to format /suborg
10 years, 9 months
fence-agents: master - fence_apc: Problem with <ENTER> prompt
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=825e27...
Commit: 825e2739411c1421fba2090a71244ad1a3299a7b
Parent: fd471013bdda9202b045ebbfd00edeb734c41f13
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Thu Jun 27 13:27:32 2013 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Thu Jun 27 13:27:32 2013 +0200
fence_apc: Problem with <ENTER> prompt
After introducing support for firmware 5.x, the length of command prompt regular expressions is not strictly equal to one.
This patches solves this problem by moving '<ENTER>' prompt to first position (index 0), so we do not rely on length of
command prompt.
---
fence/agents/apc/fence_apc.py | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index 13b1e69..24ab5ee 100644
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -68,7 +68,7 @@ def get_power_status(conn, options):
conn.send_eol(options["--switch"])
while True:
- exp_result = conn.log_expect(options, options["--command-prompt"] + [ "Press <ENTER>" ], int(options["--shell-timeout"]))
+ exp_result = conn.log_expect(options, ["Press <ENTER>" ] + options["--command-prompt"], int(options["--shell-timeout"]))
lines = conn.before.split("\n")
show_re = re.compile('(^|\x0D)\s*(\d+)- (.*?)\s+(ON|OFF)\s*')
for x in lines:
@@ -76,7 +76,7 @@ def get_power_status(conn, options):
if (res != None):
outlets[res.group(2)] = (res.group(3), res.group(4))
conn.send_eol("")
- if exp_result == 0:
+ if exp_result != 0:
break
conn.send(chr(03))
conn.log_expect(options, "- Logout", int(options["--shell-timeout"]))
@@ -146,7 +146,7 @@ def set_power_status(conn, options):
else:
conn.send_eol(options["--switch"])
- while 1 == conn.log_expect(options, options["--command-prompt"] + [ "Press <ENTER>" ], int(options["--shell-timeout"])):
+ while 0 == conn.log_expect(options, [ "Press <ENTER>" ] + options["--command-prompt"], int(options["--shell-timeout"])):
conn.send_eol("")
conn.send_eol(options["--plug"]+"")
10 years, 9 months
fence-agents: RHEL6 - fence_apc: Change long options to short ones
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=c39920...
Commit: c399203557e791f7e92e838c948a1b7d5582d7cd
Parent: 8015ec16e254bdd43fac75c6f56fe4dc1ba8031d
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Thu Jun 27 13:18:56 2013 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Thu Jun 27 13:18:56 2013 +0200
fence_apc: Change long options to short ones
Resolves: rhbz886614
---
fence/agents/apc/fence_apc.py | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index d1c71b4..78e709f 100644
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -186,7 +186,7 @@ def get_power_status5(conn, options):
conn.send_eol("olStatus all")
- exp_result = conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
+ exp_result = conn.log_expect(options, options["-c"], int(options["-Y"]))
lines = conn.before.split("\n")
show_re = re.compile('^\s*(\d+): (.*): (On|Off)\s*$', re.IGNORECASE)
@@ -196,11 +196,11 @@ def get_power_status5(conn, options):
if (res != None):
outlets[res.group(1)] = (res.group(2), res.group(3))
- if ["list", "monitor"].count(options["--action"]) == 1:
+ if ["list", "monitor"].count(options["-o"]) == 1:
return outlets
else:
try:
- (_, status) = outlets[options["--plug"]]
+ (_, status) = outlets[options["-n"]]
return status.lower().strip()
except KeyError:
fail(EC_STATUS)
@@ -209,10 +209,10 @@ def set_power_status5(conn, options):
action = {
'on' : "olOn",
'off': "olOff"
- }[options["--action"]]
+ }[options["-o"]]
- conn.send_eol(action + " " + options["--plug"])
- conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
+ conn.send_eol(action + " " + options["-n"])
+ conn.log_expect(options, options["-c"], int(options["-g"]))
def main():
device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug",
10 years, 9 months
fence-agents: RHEL6 - fence_apc: Add support for firmware 5.x
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=8015ec...
Commit: 8015ec16e254bdd43fac75c6f56fe4dc1ba8031d
Parent: 2398c9b5741eb5e5191afda535b27f781ac263a1
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Thu Jun 27 13:05:26 2013 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Thu Jun 27 13:05:26 2013 +0200
fence_apc: Add support for firmware 5.x
New major version of firmware is now supported.
Resolves: rhbz#886614
---
fence/agents/apc/fence_apc.py | 56 +++++++++++++++++++++++++++++++++++------
1 files changed, 48 insertions(+), 8 deletions(-)
diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index 61463d0..d1c71b4 100644
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -68,7 +68,7 @@ def get_power_status(conn, options):
conn.send_eol(options["-s"])
while True:
- exp_result = conn.log_expect(options, [ options["-c"], "Press <ENTER>" ], int(options["-Y"]))
+ exp_result = conn.log_expect(options, [ "Press <ENTER>" ] + options["-c"], int(options["-Y"]))
lines = conn.before.split("\n");
show_re = re.compile('(^|\x0D)\s*(\d+)- (.*?)\s+(ON|OFF)\s*')
for x in lines:
@@ -76,7 +76,7 @@ def get_power_status(conn, options):
if (res != None):
outlets[res.group(2)] = (res.group(3), res.group(4))
conn.send_eol("")
- if exp_result == 0:
+ if exp_result != 0:
break
conn.send(chr(03))
conn.log_expect(options, "- Logout", int(options["-Y"]))
@@ -151,7 +151,7 @@ def set_power_status(conn, options):
else:
conn.send_eol(options["-s"])
- while 1 == conn.log_expect(options, [ options["-c"], "Press <ENTER>" ], int(options["-Y"])):
+ while 0 == conn.log_expect(options, [ "Press <ENTER>" ] + options["-c"], int(options["-Y"])):
conn.send_eol("")
conn.send_eol(options["-n"]+"")
conn.log_expect(options, options["-c"], int(options["-Y"]))
@@ -180,16 +180,50 @@ def set_power_status(conn, options):
fail(EC_CONNECTION_LOST)
except pexpect.TIMEOUT:
fail(EC_TIMED_OUT)
+def get_power_status5(conn, options):
+ exp_result = 0
+ outlets = {}
+
+ conn.send_eol("olStatus all")
+
+ exp_result = conn.log_expect(options, options["--command-prompt"], int(options["--shell-timeout"]))
+ lines = conn.before.split("\n")
+
+ show_re = re.compile('^\s*(\d+): (.*): (On|Off)\s*$', re.IGNORECASE)
+
+ for x in lines:
+ res = show_re.search(x)
+ if (res != None):
+ outlets[res.group(1)] = (res.group(2), res.group(3))
+
+ if ["list", "monitor"].count(options["--action"]) == 1:
+ return outlets
+ else:
+ try:
+ (_, status) = outlets[options["--plug"]]
+ return status.lower().strip()
+ except KeyError:
+ fail(EC_STATUS)
+
+def set_power_status5(conn, options):
+ action = {
+ 'on' : "olOn",
+ 'off': "olOff"
+ }[options["--action"]]
+
+ conn.send_eol(action + " " + options["--plug"])
+ conn.log_expect(options, options["--command-prompt"], int(options["--power-timeout"]))
def main():
device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug",
"action", "ipaddr", "login", "passwd", "passwd_script",
"secure", "port", "identity_file", "switch", "test", "separator",
- "inet4_only", "inet6_only", "ipport",
+ "inet4_only", "inet6_only", "ipport", "cmd_prompt",
"power_timeout", "shell_timeout", "login_timeout", "power_wait" ]
atexit.register(atexit_handler)
+ all_opt["cmd_prompt"]["default"] = [ "\n>", "\napc>" ]
options = check_input(device_opt, process_input(device_opt))
##
@@ -197,9 +231,6 @@ def main():
#####
options["ssh_options"] = "-1 -c blowfish"
- if 0 == options.has_key("-c"):
- options["-c"] = "\n>"
-
docs = { }
docs["shortdesc"] = "Fence agent for APC over telnet/ssh"
docs["longdesc"] = "fence_apc is an I/O Fencing agent \
@@ -220,7 +251,16 @@ will block any necessary fencing actions."
## Operate the fencing device
####
conn = fence_login(options)
- result = fence_action(conn, options, set_power_status, get_power_status, get_power_status)
+
+ ## Detect firmware version (ASCII menu vs command-line interface)
+ ## and continue with proper action
+ ####
+ result = -1
+ firmware_version = re.compile('\s*v(\d)*\.').search(conn.before)
+ if (firmware_version != None) and (firmware_version.group(1) == "5"):
+ result = fence_action(conn, options, set_power_status5, get_power_status5, get_power_status5)
+ else:
+ result = fence_action(conn, options, set_power_status, get_power_status, get_power_status)
##
## Logout from system
10 years, 9 months
fence-agents: RHEL6 - fence_scsi: Add "delay" option
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=2398c9...
Commit: 2398c9b5741eb5e5191afda535b27f781ac263a1
Parent: 6fbdb7961c36a8f0ca9e4a535795f5872f71a029
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Fri May 31 10:15:44 2013 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Thu Jun 27 11:11:54 2013 +0200
fence_scsi: Add "delay" option
Adding "delay" option to fence_scsi.
WARNING: we are using -H / delay= instead of "-f" as in fencing library because -f is already used in fence_scsi.
Resolves: rhbz#912773
---
fence/agents/scsi/fence_scsi.pl | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
index 45cfe22..a447661 100644
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -664,6 +664,9 @@ sub get_options_stdin ()
elsif ($opt eq "action") {
$opt_o = $arg;
}
+ elsif ($opt eq "delay") {
+ $opt_H = $arg;
+ }
}
}
@@ -677,6 +680,7 @@ sub print_usage ()
print " -a Use APTPL flag\n";
print " -d <devices> Devices to be used for action\n";
print " -f <logfile> File to write debug/error output\n";
+ print " -H <timeout> Wait X seconds before fencing is started\n";
print " -h Usage\n";
print " -k <key> Key to be used for current action\n";
print " -n <nodename> Name of node to operate on\n";
@@ -723,6 +727,14 @@ sub print_metadata ()
"File to write error/debug messages" .
"</shortdesc>\n";
print "\t</parameter>\n";
+ print "\t</parameter>\n";
+ print "\t<parameter name=\"delay\" unique=\"0\" required=\"0\">\n";
+ print "\t\t<getopt mixed=\"-H\"/>\n";
+ print "\t\t<content type=\"string\"/>\n";
+ print "\t\t<shortdesc lang=\"en\">" .
+ "Wait X seconds before fencing is started" .
+ "</shortdesc>\n";
+ print "\t</parameter>\n";
print "\t<parameter name=\"key\" unique=\"0\" required=\"0\">\n";
print "\t\t<getopt mixed=\"-k\"/>\n";
print "\t\t<content type=\"string\"/>\n";
@@ -759,8 +771,7 @@ sub print_metadata ()
################################################################################
if (@ARGV > 0) {
- getopts ("ad:f:hk:n:o:qV") or print_usage;
-
+ getopts ("ad:f:H:hk:n:o:qV") or print_usage;
print_usage if (defined $opt_h);
print_version if (defined $opt_V);
} else {
@@ -828,6 +839,12 @@ if (!defined $opt_o) {
$opt_o = "off";
}
+## Wait for defined period (-H / delay= )
+##
+if ((defined $opt_H) && ($opt_H =~ /^[0-9]+/)) {
+ sleep($opt_H);
+}
+
## determine the action to perform
##
if ($opt_o =~ /^on$/i) {
10 years, 9 months
fence-agents: RHEL6 - fence_scsi: Add 'unfence' to manual page
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=6fbdb7...
Commit: 6fbdb7961c36a8f0ca9e4a535795f5872f71a029
Parent: 068f61c638b2ef88badfd1a5d89b92cc77c4df14
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon May 27 15:19:59 2013 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Wed Jun 26 13:48:40 2013 +0200
fence_scsi: Add 'unfence' to manual page
Resolves: rhbz#887349
---
fence/agents/scsi/fence_scsi.8 | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/fence/agents/scsi/fence_scsi.8 b/fence/agents/scsi/fence_scsi.8
index 0d70930..da2e451 100644
--- a/fence/agents/scsi/fence_scsi.8
+++ b/fence/agents/scsi/fence_scsi.8
@@ -21,7 +21,8 @@ registrants only" reservation on the device(s). The result is that
only registered nodes may write to the device(s). When a node failure
occurs, the fence_scsi agent will remove the key belonging to the
failed node from the device(s). The failed node will no longer be able
-to write to the device(s). A manual reboot is required.
+to write to the device(s). A manual reboot is required. In the cluster
+environment unfence action should be configured also.
Keys are either be specified manually (see -k option) or generated
automatically (see -n option). Automatic key generation requires that
10 years, 9 months