fence-agents: master - [refactor] simplifying function metadata() + fix XML for fence_cisco_ucs
Marek GrĂ¡c
marx at fedoraproject.org
Thu Dec 4 22:53:37 UTC 2014
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=cf00fc93de753bca2e9c1720024a3a9c2bc9da99
Commit: cf00fc93de753bca2e9c1720024a3a9c2bc9da99
Parent: 64e405b09f024e59258d215a7127eea285d184d0
Author: Marek 'marx' Grac <mgrac at redhat.com>
AuthorDate: Thu Dec 4 23:50:14 2014 +0100
Committer: Marek 'marx' Grac <mgrac at redhat.com>
CommitterDate: Thu Dec 4 23:50:14 2014 +0100
[refactor] simplifying function metadata() + fix XML for fence_cisco_ucs
Two if-s where removed as they are no longer needed by fence agents. One of
its impact was that two fence agents has changed their XML metadata. In case
of fence_ovh it was because default value was set even when it should not be.
And in the case of cisco_ucs, default was not propagated properly because
it was empty string.
---
fence/agents/lib/fencing.py.py | 14 ++++----------
fence/agents/ovh/Makefile.am | 2 +-
fence/agents/ovh/fence_ovh.py | 1 -
tests/data/metadata/fence_cisco_ucs.xml | 2 +-
4 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 370e42f..645441f 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -507,7 +507,7 @@ def usage(avail_opt):
if len(value["help"]) != 0:
print " " + value["help"]
-def metadata(avail_opt, options, docs):
+def metadata(avail_opt, docs):
# avail_opt has to be unique, if there are duplicities then they should be removed
sorted_list = [(key, all_opt[key]) for key in list(set(avail_opt))]
sorted_list.sort(lambda x, y: cmp(x[0], y[0]))
@@ -519,8 +519,7 @@ def metadata(avail_opt, options, docs):
for (symlink, desc) in docs.get("symlink", []):
print "<symlink name=\"" + symlink + "\" shortdesc=\"" + desc + "\"/>"
print "<longdesc>" + docs["longdesc"] + "</longdesc>"
- if docs.has_key("vendorurl"):
- print "<vendor-url>" + docs["vendorurl"] + "</vendor-url>"
+ print "<vendor-url>" + docs["vendorurl"] + "</vendor-url>"
print "<parameters>"
for option, _ in sorted_list:
if all_opt[option].has_key("shortdesc"):
@@ -528,12 +527,7 @@ def metadata(avail_opt, options, docs):
default = ""
if all_opt[option].has_key("default"):
- default = str(all_opt[option]["default"])
- elif options.has_key("--" + all_opt[option]["longopt"]):
- default = "true"
-
- if default:
- default = "default=\"" + _encode_html_entities(default) + "\" "
+ default = "default=\"" + _encode_html_entities(str(all_opt[option]["default"])) + "\" "
mixed = all_opt[option]["help"]
## split it between option and help text
@@ -713,7 +707,7 @@ def show_docs(options, docs=None):
sys.exit(0)
if options.get("--action", "") == "metadata":
- metadata(device_opt, options, docs)
+ metadata(device_opt, docs)
sys.exit(0)
if options.has_key("--version"):
diff --git a/fence/agents/ovh/Makefile.am b/fence/agents/ovh/Makefile.am
index f0d3f29..3793562 100644
--- a/fence/agents/ovh/Makefile.am
+++ b/fence/agents/ovh/Makefile.am
@@ -10,7 +10,7 @@ sbin_SCRIPTS = $(TARGET)
man_MANS = $(TARGET).8
-FENCE_TEST_ARGS = -l test -p test -n 1
+FENCE_TEST_ARGS = -l test -p test -n 1 --email test at test.te
include $(top_srcdir)/make/fencebuild.mk
include $(top_srcdir)/make/fenceman.mk
diff --git a/fence/agents/ovh/fence_ovh.py b/fence/agents/ovh/fence_ovh.py
index 55675db..3dfee49 100644
--- a/fence/agents/ovh/fence_ovh.py
+++ b/fence/agents/ovh/fence_ovh.py
@@ -32,7 +32,6 @@ def define_new_opts():
"help" : "-Z, --email=[email] email for reboot message: admin at domain.com",
"required" : "1",
"shortdesc" : "Reboot email",
- "default" : "",
"order" : 1}
def netboot_reboot(conn, options, mode):
diff --git a/tests/data/metadata/fence_cisco_ucs.xml b/tests/data/metadata/fence_cisco_ucs.xml
index 5e7f869..52ff1b1 100644
--- a/tests/data/metadata/fence_cisco_ucs.xml
+++ b/tests/data/metadata/fence_cisco_ucs.xml
@@ -70,7 +70,7 @@
</parameter>
<parameter name="suborg" unique="0" required="0">
<getopt mixed="--suborg=[path]" />
- <content type="string" />
+ <content type="string" default="" />
<shortdesc lang="en">Additional path needed to access suborganization</shortdesc>
</parameter>
<parameter name="verbose" unique="0" required="0">
More information about the cluster-commits
mailing list