Gitweb:
http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=402d7e...
Commit: 402d7eed3e7b9648ee8cc38e420e481800b03309
Parent: 7d024a67652b3f92ebdfd37da17c5d82a16097e3
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Fri Nov 23 16:03:24 2012 +0100
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Sat Nov 24 11:36:58 2012 +0100
fencing: Improve XML metadata output
Problem occurs when special characters are part of default values.
---
fence/agents/lib/fencing.py.py | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index d48e3b7..3f994b9 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -503,17 +503,25 @@ def metadata(avail_opt, options, docs):
default = ""
if all_opt[option].has_key("default"):
- default =
"default=\""+str(all_opt[option]["default"])+"\""
+ default = str(all_opt[option]["default"])
elif options.has_key("--" + all_opt[option]["longopt"]) and
all_opt[option]["getopt"].endswith(":"):
if options["--" + all_opt[option]["longopt"]]:
try:
- default = "default=\"" + options["--" +
all_opt[option]["longopt"]] + "\""
+ default = options["--" + all_opt[option]["longopt"]]
except TypeError:
## @todo/@note: Currently there is no clean way how to handle lists
## we can create a string from it but we can't set it on command line
- default = "default=\"" + str(options["--" +
all_opt[option]["longopt"]]) +"\""
+ default = str(options["--" + all_opt[option]["longopt"]])
elif options.has_key("--" + all_opt[option]["longopt"]):
- default = "default=\"true\" "
+ default = "true"
+
+ if default:
+ default = default.replace("&", "&" )
+ default = default.replace('"', """ )
+ default = default.replace('<', "<" )
+ default = default.replace('>', ">" )
+ default = default.replace("'", "'" )
+ default = "default=\"" + default + "\" "
mixed = all_opt[option]["help"]
## split it between option and help text