cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Marek 'marx' Grac <mgrac@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 2/2] fencing: Add information about option that have to be selected from list to XML metadata
Date: Wed, 20 Nov 2013 17:35:13 +0100	[thread overview]
Message-ID: <1384965313-12857-2-git-send-email-mgrac@redhat.com> (raw)
In-Reply-To: <1384965313-12857-1-git-send-email-mgrac@redhat.com>

---
 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



      reply	other threads:[~2013-11-20 16:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-20 16:35 [Cluster-devel] [PATCH 1/2] fencing: Add support for options which should be selected from a list of values Marek 'marx' Grac
2013-11-20 16:35 ` Marek 'marx' Grac [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1384965313-12857-2-git-send-email-mgrac@redhat.com \
    --to=mgrac@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).