Skip to contentSkip to conversation

conga/luci cluster/clu_portlet_fetcher cluster ...

Cluster-devel [email protected] 1 participant 1 message Jun 7, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: conga
Branch: EXPERIMENTAL
Changes by: rmccabe at sourceware.org 2007-06-07 06:41:06

Modified files:
luci/cluster : clu_portlet_fetcher form-macros index_html
resource-form-macros resource_form_handlers.js
luci/homebase : form-macros portlet_homebase luci/site/luci/Extensions: LuciClusterInfo.py LuciDB.py
LuciZope.py RicciQueries.py cluster_adapters.py conga_constants.py
luci/site/luci/Extensions/ClusterModel: ModelBuilder.py

Log message:
Various fixes and cleanups

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/clu_portlet_fetcher.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.2&r2=1.2.8.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.198.2.3&r2=1.198.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/index_html.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.32&r2=1.32.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.37.2.2&r2=1.37.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.34&r2=1.34.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/form-macros.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.56.2.1&r2=1.56.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/portlet_homebase.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.8&r2=1.8.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciClusterInfo.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.7&r2=1.1.2.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciDB.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.14&r2=1.1.2.15
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciZope.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.8&r2=1.1.2.9
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/RicciQueries.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.6&r2=1.1.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.255.2.12&r2=1.255.2.13
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_constants.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.39.2.7&r2=1.39.2.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ClusterModel/ModelBuilder.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.1.2.6&r2=1.1.2.7

luci/cluster/clu_portlet_fetcher +19 -32
@@ -4,39 +4,26 @@
 <body>
 
 <metal:leftcolumn define-macro="left_column">
-<!-- unchecked_clusystems are all clusters...the check_clusters call filters list through user permissions -->
-<span tal:define="global unchecked_clusystems root/luci/systems/cluster/objectItems"/>
-<span tal:define="global clusystems python:here.check_clusters(request,unchecked_clusystems)"/>
-<div tal:omit-tag="" metal:use-macro="here/portlet_cluconfig/macros/cluchooseportlet" />
-<span tal:omit-tag="" tal:define="global hasclustername request/clustername |nothing"/>
-<span tal:omit-tag="" tal:condition="hasclustername">
-<div tal:omit-tag="" metal:use-macro="here/portlet_cluconfig/macros/cluconfigportlet" />
-</span>
+	<tal:comment tal:replace=nothing>
+		unchecked_clusystems are all clusters...
+		the check_clusters call filters list through user permissions
+	</tal:comment>
+
+	<tal:block
+		tal:define="unchecked_clusystems /root/luci/systems/cluster/objectItems">
+		<tal:block
+			tal:define="global clusystems python:here.check_clusters(unchecked_clusystems)" />
+	</tal:block>
+
+	<tal:block
+		metal:use-macro="here/portlet_cluconfig/macros/cluchooseportlet" />
+	<tal:block
+		tal:define="global hasclustername request/clustername | nothing" />
+	<tal:block tal:condition="hasclustername">
+		<tal:block
+			metal:use-macro="here/portlet_cluconfig/macros/cluconfigportlet" />
+	</tal:block>
 </metal:leftcolumn>
 
-<!--
-
-<metal:rightcolumn define-macro="right_column"
-   tal:define="Iterator python:modules['Products.CMFPlone'].IndexIterator;
-               tabindex python:Iterator(pos=20000);"
-   tal:condition="sr">
-
-    <metal:block tal:repeat="slot sr">
-        <tal:dontcrash tal:on-error="python:context.plone_log('Error %s on %s while rendering portlet %s'%(error.type, error.value, slot[0]))"
-                       tal:define="pathexpr python:slot[0];
-                                   usemacro python:slot[1];">
-
-        <tal:block tal:condition="usemacro">
-            <metal:block metal:use-macro="python:path(pathexpr)" />
-        </tal:block>
-
-        <span tal:condition="not: usemacro"
-              tal:replace="structure python:path(pathexpr)" />
-
-        </tal:dontcrash>
-    </metal:block>
-</metal:rightcolumn>
--->
-
 </body>
 </html>
luci/cluster/form-macros +8 -2
@@ -4413,6 +4413,12 @@
 	<tal:block tal:condition="python: type == 'tomcat-5'">
 		<div metal:use-macro="here/resource-form-macros/macros/tomcat-5_macro" />
 	</tal:block>
+	<tal:block tal:condition="python: type == 'SAPInstance'">
+		<div metal:use-macro="here/resource-form-macros/macros/SAPInstance_macro" />
+	</tal:block>
+	<tal:block tal:condition="python: type == 'SAPDatabase'">
+		<div metal:use-macro="here/resource-form-macros/macros/SAPDatabase_macro" />
+	</tal:block>
 </div>
 
 <div metal:define-macro="service-config-head-macro" tal:omit-tag="">
@@ -4430,10 +4436,10 @@
 		global global_resources python: here.getResourcesInfo(modelb, request);
 		global sstat python: here.getClusterStatus(request, ricci_agent);
 		global sinfo python: here.getServiceInfo(sstat, modelb, request);
-		global running sinfo/running | nothing;" />
+		global running sinfo/running | nothing" />
 
 	<tal:block tal:replace="structure python: '<script type='+chr(0x22)+'text/javascript'+chr(0x22)+'>'" />
-		var uuid_list = <tal:block tal:replace="sinfo/uuid_list" />;
+		var uuid_list = <tal:block tal:replace="sinfo/uuid_list | nothing" />;
 		var global_resources = <tal:block tal:replace="python: map(lambda x: str(x['name']), global_resources) or 'null'" />;
 		var active_resources = <tal:block tal:replace="python: map(lambda x: str(x['name']), sinfo['resource_list']) or 'null'" />;
 		var resource_names = <tal:block tal:replace="python: (map(lambda x: str(x['name']), global_resources) + map(lambda x: str(x['name']), sinfo['resource_list'])) or 'null'" />;
luci/cluster/index_html +3 -3
@@ -26,7 +26,7 @@
       <metal:headslot define-slot="head_slot" />
 	    <tal:block tal:define="
 			global sinfo nothing;
-			global hascluster request/clustername |nothing;
+			global hascluster request/clustername | nothing;
 			global isBusy python: False;
 			global firsttime nothing;
 			global ri_agent nothing;
@@ -39,7 +39,7 @@
 				global isVirtualized resmap/isVirtualized | nothing;
 				global os_version resmap/os | nothing;
 				global isBusy python:here.isClusterBusy(request);
-				global firsttime request/busyfirst |nothing" />
+				global firsttime request/busyfirst | nothing" />
 
 			<tal:block tal:condition="firsttime">
 				<tal:block tal:define="global busywaiting python:True" />
@@ -47,7 +47,7 @@
 					tal:attributes="content isBusy/refreshurl | string:." />
 			</tal:block>
 
-			<tal:block tal:define="global busy isBusy/busy |nothing"/>
+			<tal:block tal:define="global busy isBusy/busy | nothing" />
 
 			<tal:block tal:condition="busy">
 				<tal:block tal:define="global busywaiting python:True" />
luci/cluster/resource-form-macros +12 -0
@@ -145,6 +145,8 @@
 		<div metal:use-macro="here/resource-form-macros/macros/openldap_macro" />
 		<div metal:use-macro="here/resource-form-macros/macros/postgres-8_macro" />
 		<div metal:use-macro="here/resource-form-macros/macros/tomcat-5_macro" />
+		<div metal:use-macro="here/resource-form-macros/macros/SAPInstance_macro" />
+		<div metal:use-macro="here/resource-form-macros/macros/SAPDatabase_macro" />
 	</div>
 </div>
 
@@ -213,6 +215,8 @@
 		<div metal:use-macro="here/resource-form-macros/macros/openldap_macro" />
 		<div metal:use-macro="here/resource-form-macros/macros/postgres-8_macro" />
 		<div metal:use-macro="here/resource-form-macros/macros/tomcat-5_macro" />
+		<div metal:use-macro="here/resource-form-macros/macros/SAPInstance_macro" />
+		<div metal:use-macro="here/resource-form-macros/macros/SAPDatabase_macro" />
 	</div>
 </div>
 
@@ -1170,6 +1174,14 @@
 	</form>
 </div>
 
+<div class="rescfg" name="SAPInstance"
+	tal:attributes="id res/name | nothing" metal:define-macro="SAPInstance_macro">
+</div>
+
+<div class="rescfg" name="SAPDatabase"
+	tal:attributes="id res/name | nothing" metal:define-macro="SAPDatabase_macro">
+</div>
+
 <div class="rescfg" name="MYSQL"
 	tal:attributes="id res/name | nothing" metal:define-macro="mysql_macro">
 	<p class="reshdr">MySQL Configuration</p>
luci/cluster/resource_form_handlers.js +12 -0
@@ -233,6 +233,16 @@
 	return (errors);
 }
 
+function validate_sapinstance(form) {
+	var errors = new Array();
+	return (errors);
+}
+
+function validate_sapinstance(form) {
+	var errors = new Array();
+	return (errors);
+}
+
 var required_children = new Array();
 required_children['nfsx'] = [ 'nfsc' ];
 
@@ -256,6 +266,8 @@
 form_validators['openldap'] = validate_openldap;
 form_validators['mysql'] = validate_mysql;
 form_validators['lvm'] = validate_lvm;
+form_validators['SAPInstance'] = validate_sapinstance;
+form_validators['SAPDatabase'] = validate_sapdatabase;
 
 function check_form(form) {
 	var valfn = form_validators[form.type.value];
luci/homebase/form-macros +21 -35

125 lines not on this page · raw message

luci/homebase/portlet_homebase +12 -12
@@ -13,21 +13,21 @@
 	<dd class="portletItemSingle">
 	<ul class="portletCluConfigTree cluConfigTreeLevel0">
 		<tal:portal repeat="c python:data.get('children',[])">
-			<li tal:condition="not: c/currentItem" class="cluConfigTreeItem visualNoMarker">
-			<div tal:condition="not: c/currentItem">
-				<a class="visualIconPadding"
-					tal:attributes="href c/absolute_url;
-						title c/Description |nothing"
-					tal:content="c/Title|nothing">Title</a>
-			</div>
+			<li tal:condition="not:exists:c/currentItem" class="cluConfigTreeItem visualNoMarker">
+				<div>
+					<a class="visualIconPadding"
+						tal:attributes="href c/absolute_url | nothing;
+							title c/Description | nothing"
+						tal:content="c/Title | nothing">Title</a>
+				</div>
 			</li>
 
-			<li tal:condition="c/currentItem" class="cluConfigTreeCurrentItem visualNoMarker">
-				<div tal:condition="c/currentItem">
+			<li tal:condition="exists:c/currentItem" class="cluConfigTreeCurrentItem visualNoMarker">
+				<div>
 					<a class="visualIconPadding"
-						tal:attributes="href c/absolute_url;
-							title c/Description |nothing"
-						tal:content="c/Title|nothing">Title</a>
+						tal:attributes="href c/absolute_url | nothing;
+							title c/Description | nothing"
+						tal:content="c/Title| nothing">Title</a>
 				</div>
 			</li>
 		</tal:portal>
luci/site/luci/Extensions/Attic/LuciClusterInfo.py +162 -175

673 lines not on this page · raw message

luci/site/luci/Extensions/Attic/LuciDB.py +17 -5
@@ -669,7 +669,7 @@
 				% (clustername, e, str(e)))
 		return None
 
-	if isAdmin(self) or cluster_permission_check(self, cluster_obj):
+	if cluster_permission_check(self, cluster_obj):
 		return cluster_obj
 	return None
 
@@ -713,10 +713,19 @@
 	return allowed_systems(storage)
 
 def check_clusters(self, clusters):
-	user = getSecurityManager().getUser()
-	return filter(lambda x: user.has_permission('View', x[1]), clusters)
+	ret = []
+	try:
+		user = getSecurityManager().getUser()
+		ret = filter(lambda x: user.has_permission('View', x[1]), clusters)
+	except Exception, e:
+		if LUCI_DEBUG_MODE is True:
+			luci_log.debug_verbose('CC0: %r %s' % (e, str(e)))
+	return ret
+
+def cluster_permission_check(self, cluster):
+	if isAdmin(self):
+		return True
 
-def cluster_permission_check(cluster):
 	try:
 		user = getSecurityManager().getUser()
 		if user.has_permission('View', cluster[1]):
@@ -736,8 +745,11 @@
 
 def getRicciAgent(self, clustername, exclude_names=None, exclude_busy=False):
 	try:
-		perm = cluster_permission_check(clustername)
+		perm = cluster_permission_check(self, clustername)
 		if not perm:
+			if LUCI_DEBUG_MODE is True:
+				luci_log.debug_verbose('GRA0: no permission for %s' \
+					% clustername)
 			return None
 	except Exception, e:
 		if LUCI_DEBUG_MODE is True:
luci/site/luci/Extensions/Attic/LuciZope.py +0 -1
@@ -123,7 +123,6 @@
 		if LUCI_DEBUG_MODE is True:
 			luci_log.debug_verbose('Appending model to request failed: %r %s' \
 				% (e, str(e)))
-		return 'An error occurred while storing the cluster model'
 
 def GetReqVars(req, varlist):
 	ret = {}
luci/site/luci/Extensions/Attic/RicciQueries.py +4 -8
@@ -743,12 +743,8 @@
 	if not ret:
 		return None
 
-	cur = ret
-	while len(cur.childNodes) > 0:
-		for i in cur.childNodes:
-			if i.nodeType == xml.dom.Node.ELEMENT_NODE:
-				if i.nodeName == 'var' and i.getAttribute('name') == 'cluster.conf':
-					return i.childNodes[1].cloneNode(True)
-				else:
-					cur = i
+	var_nodes = ret.getElementsByTagName('var')
+	for i in var_nodes:
+		if i.getAttribute('name') == 'cluster.conf':
+			return i.childNodes[0]
 	return None
luci/site/luci/Extensions/cluster_adapters.py +27 -24

102 lines not on this page · raw message

luci/site/luci/Extensions/conga_constants.py +1 -0
@@ -100,6 +100,7 @@
 PLONE_ROOT = 'luci'
 CLUSTER_FOLDER_PATH = '/luci/systems/cluster/'
 STORAGE_FOLDER_PATH = '/luci/systems/storage/'
+LUCI_CLUSTER_BASE_URL = '/luci/cluster/index_html'
 
 # Node states
 NODE_ACTIVE		= '0'
luci/site/luci/Extensions/ClusterModel/Attic/ModelBuilder.py +3 -0
@@ -505,6 +505,9 @@
     #Find the clusternodes obj and return get_children
     return self.clusternodes_ptr.getChildren()
 
+  def getNodeNames(self):
+    return map(lambda x: x.getName(), self.clusternodes_ptr.getChildren())
+
   def addNode(self, clusternode):
     self.clusternodes_ptr.addChild(clusternode)
     if self.usesMulticast is True: