[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [PATCH 2/2] fencing: Add information about option that have to be selected from list to XML metadata



---
 fence/agents/lib/fencing.py.py |    7 ++++++-
 fence/agents/lib/metadata.rng  |   24 ++++++++++++++++++------
 2 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index a19ae20..2b914f2 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -477,7 +477,12 @@ def metadata(avail_opt, options, docs):
 			mixed = mixed.replace("<", "&lt;").replace(">", "&gt;")
 			print "\t\t<getopt mixed=\"" + mixed + "\" />"
 
-			if all_opt[option]["getopt"].count(":") > 0:
+			if all_opt[option].has_key("choices"):
+				print "\t\t<content type=\"select\" "+default+" >"
+				for choice in all_opt[option]["choices"]:
+					print "\t\t\t<option value=\"%s\" />" % (choice)
+				print "\t\t</content>"
+			elif all_opt[option]["getopt"].count(":") > 0:
 				print "\t\t<content type=\"string\" "+default+" />"
 			else:
 				print "\t\t<content type=\"boolean\" "+default+" />"
diff --git a/fence/agents/lib/metadata.rng b/fence/agents/lib/metadata.rng
index 2566fee..c7758e6 100644
--- a/fence/agents/lib/metadata.rng
+++ b/fence/agents/lib/metadata.rng
@@ -24,12 +24,24 @@
 				<attribute name="mixed" />
 			</element>
 			<element name="content">
-				<attribute name="type">
-					<choice>
-						<value>boolean</value>
-						<value>string</value>
-					</choice>
-				</attribute>
+				<choice>
+					<attribute name="type">
+						<choice>
+							<value>boolean</value>
+							<value>string</value>
+						</choice>
+					</attribute>
+					<group>
+						<attribute name="type">
+							<value>select</value>
+						</attribute>
+						<zeroOrMore>
+							<element name="option">
+								<attribute name="value" />
+							</element>
+						</zeroOrMore>
+					</group>
+				</choice>
 				<optional>
 					<attribute name="default"> <text /> </attribute>
 				</optional>
-- 
1.7.7.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]