All of lore.kernel.org
 help / color / mirror / Atom feed
From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci cluster/form-macros cluster/index_h ...
Date: 20 Feb 2007 23:07:01 -0000	[thread overview]
Message-ID: <20070220230701.4552.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2007-02-20 23:07:00

Modified files:
	luci/cluster   : form-macros index_html resource-form-macros 
	luci/site/luci/Extensions: cluster_adapters.py ricci_bridge.py 

Log message:
	- Only allow resources using the new application resource agents to be added and configured if the 'rgmanager-app-agents' package is installed.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.191&r2=1.192
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/index_html.diff?cvsroot=cluster&r1=1.30&r2=1.31
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.33&r2=1.34
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.241&r2=1.242
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_bridge.py.diff?cvsroot=cluster&r1=1.56&r2=1.57

--- conga/luci/cluster/form-macros	2007/02/16 05:26:18	1.191
+++ conga/luci/cluster/form-macros	2007/02/20 23:06:59	1.192
@@ -4117,6 +4117,8 @@
 	<tal:block metal:use-macro="here/form-macros/macros/service-config-head-macro" />
 
 	<h2>Add a Service</h2>
+	<tal:block tal:define="
+		global clusterinfo python: here.getClusterInfo(modelb, request)" />
 
 	<div id="resskel" class="invisible">
 		<tal:block metal:use-macro="here/resource-form-macros/macros/service-compose-macro" />
@@ -4178,8 +4180,6 @@
 
 	<div class="service_comp_list">
 		<form name="master" method="post">
-		<tal:block
-			tal:define="global clusterinfo python: here.getClusterInfo(modelb, request)" />
 		<input type="button" value="Add a resource to this service"
 			onclick="add_child_resource(this.form);" />
 		<input type="hidden" name="pagetype"
@@ -4395,6 +4395,8 @@
 	<br/>
 
 	<h2>Service Composition</h2>
+	<tal:block tal:define="
+		global clusterinfo python: here.getClusterInfo(modelb, request)" />
 
 	<div id="resskel" class="invisible">
 		<tal:block metal:use-macro="here/resource-form-macros/macros/service-compose-macro" />
@@ -4474,8 +4476,6 @@
 		</form>
 
 		<form name="master" method="post">
-		<tal:block
-			tal:define="global clusterinfo python: here.getClusterInfo(modelb, request)" />
 		<input type="hidden" name="pagetype"
 			tal:attributes="
 				value request/pagetype | request/form/pagetype | nothing" />
--- conga/luci/cluster/index_html	2006/12/21 05:08:48	1.30
+++ conga/luci/cluster/index_html	2007/02/20 23:06:59	1.31
@@ -32,10 +32,6 @@
 			global ri_agent nothing;
 			global busywaiting python:None" />
 
-		<tal:block tal:condition="not: hascluster">
-		    <meta googaa="ooo"/>
-		</tal:block>
-
 		<tal:block tal:condition="hascluster">
 			<tal:block tal:define="
 				global ri_agent python:here.getRicciAgentForCluster(request);
@@ -45,6 +41,10 @@
 				global isBusy python:here.isClusterBusy(request);
 				global firsttime request/busyfirst |nothing" />
 
+			<tal:block tal:condition="ri_agent">
+				<tal:block tal:define="dummy python:request.SESSION.set('ricci', ri_agent)" />
+			</tal:block>
+
 			<tal:block tal:condition="firsttime">
 				<tal:block tal:define="global busywaiting python:True" />
 				<meta http-equiv="refresh"
--- conga/luci/cluster/resource-form-macros	2007/02/16 02:06:08	1.33
+++ conga/luci/cluster/resource-form-macros	2007/02/20 23:06:59	1.34
@@ -120,7 +120,7 @@
 			<option name="SMB" value="SMB">Samba</option>
 
 			<tal:block
-				tal:condition="python: os_version and os_version == 'rhel4'">
+				tal:condition="python:clusterinfo and 'has_rgmanager_app_agents' in clusterinfo and clusterinfo['has_rgmanager_app_agents'] is True">
 				<option name="APACHE" value="APACHE">Apache</option>
 				<option name="LVM" value="LVM">LVM</option>
 				<option name="MYSQL" value="MYSQL">MySQL</option>
@@ -170,7 +170,7 @@
 			<option name="SMB" value="SMB">Samba</option>
 
 			<tal:block
-				tal:condition="python: os_version and os_version == 'rhel4'">
+				tal:condition="python:clusterinfo and 'has_rgmanager_app_agents' in clusterinfo and clusterinfo['has_rgmanager_app_agents'] is True">
 				<option name="APACHE" value="APACHE">Apache</option>
 				<option name="LVM" value="LVM">LVM</option>
 				<option name="MYSQL" value="MYSQL">MySQL</option>
@@ -238,7 +238,10 @@
 	</script>
 
 	<tal:block tal:define="
-		global res python: here.getResourceInfo(modelb, request);" />
+		global res python: here.getResourceInfo(modelb, request)" />
+
+	<tal:block tal:define="
+		global clusterinfo python: here.getClusterInfo(modelb, request)" />
 
 	<h2>Add a Resource</h2>
 
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2007/02/16 05:26:18	1.241
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2007/02/20 23:07:00	1.242
@@ -3895,7 +3895,18 @@
         luci_log.debug_verbose('GCI0: unable to determine cluster name')
         return {}
 
+  has_app_agents = False
+  try:
+    ricci = req.SESSION.get('ricci')
+    if not ricci:
+      raise Exception, 'blank'
+    has_app_agents = has_rgmanager_app_agents(ricci)
+  except Exception, e:
+    luci_log.debug_verbose('GCI0a: %s' % str(e))
+    has_app_agents = False
+
   clumap = {}
+  clumap['has_rgmanager_app_agents'] = has_app_agents
   if model is None:
     try:
       model = getModelForCluster(self, cluname)
--- conga/luci/site/luci/Extensions/ricci_bridge.py	2007/01/31 19:28:08	1.56
+++ conga/luci/site/luci/Extensions/ricci_bridge.py	2007/02/20 23:07:00	1.57
@@ -486,6 +486,43 @@
 	ricci_xml = rc.batch_run(batch_str)
 	return batchAttemptResult(ricci_xml)
 
+def has_rgmanager_app_agents(rc):
+	batch_str = '<module name="rpm"><request API_version="1.0"><function_call name="query"><var mutable="false" name="search" type="list_xml"><rpm name="rgmanager-app-agents"/></var></function_call></request></module>'
+
+	ricci_xml = rc.batch_run(batch_str, async=False)
+	if not ricci_xml or not ricci_xml.firstChild:
+		luci_log.debug_verbose('HRAA0: None returned')
+		return None
+
+	rpm_tags = ricci_xml.getElementsByTagName('rpm')
+	if not rpm_tags or len(rpm_tags) < 1:
+		luci_log.debug_verbose('HRAA: unexpected response %s' \
+			% ricci_xml.toxml())
+		return None
+
+	has_agents = False
+	for i in rpm_tags:
+		try:
+			name = i.getAttribute('name')
+			if not name:
+				raise Exception, 'blank'
+		except Exception, e:
+			luci_log.debug_verbose('HRAA2: %s' % str(e))
+			continue
+
+		if name.strip().lower() != 'rgmanager-app-agents':
+			continue
+
+		try:
+			version = i.getAttribute('version').strip()
+			if version:
+				has_agents = True
+		except Exception, e:
+			luci_log.debug_verbose('HRAA3: %s' % str(e))
+		break
+
+	return has_agents
+
 def nodeIsVirtual(rc):
 	batch_str = '<module name="cluster"><request API_version="1.0"><function_call name="virt_guest"/></request></module>'
 



             reply	other threads:[~2007-02-20 23:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-20 23:07 rmccabe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-07-26  4:16 [Cluster-devel] conga/luci cluster/form-macros cluster/index_h rmccabe
2007-02-20 23:09 rmccabe
2006-12-21  5:08 rmccabe
2006-11-07 21:33 rmccabe
2006-11-03 19:13 rmccabe
2006-10-31 17:28 rmccabe
2006-10-16  4:26 rmccabe
2006-09-08 22:54 rmccabe
2006-07-19 20:20 rmccabe
2006-07-05 20:13 rmccabe

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=20070220230701.4552.qmail@sourceware.org \
    --to=rmccabe@sourceware.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.