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

[Cluster-devel] conga/luci cluster/form-macros cluster/resourc ...



CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe sourceware org	2007-01-26 17:56:15

Modified files:
	luci/cluster   : form-macros resource-form-macros 
	                 resource_form_handlers.js 
	luci/site/luci/Extensions: cluster_adapters.py 

Log message:
	fix for adding global resources to services and other cleanup/polish

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.162&r2=1.163
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.29&r2=1.30
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.28&r2=1.29
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.211&r2=1.212

--- conga/luci/cluster/form-macros	2007/01/26 16:53:53	1.162
+++ conga/luci/cluster/form-macros	2007/01/26 17:56:14	1.163
@@ -223,14 +223,14 @@
 
 		<table id="systemsTable" class="systemsTable" cellspacing="0">
 			<thead class="systemsTable">
-                <tr class="systemsTable"><td class="systemsTable" colspan="2">
-                    <div class="systemsTableTop">
-                        <strong>Cluster Name</strong>
-                        <input class="hbInputSys" type="text"
+				<tr class="systemsTable"><td class="systemsTable" colspan="2">
+					<div class="systemsTableTop">
+						<strong>Cluster Name</strong>
+						<input class="hbInputSys" type="text"
 							id="clusterName" name="clusterName"
 							tal:attributes="value add_cluster/name | nothing" />
-                    </div>
-                </td></tr>
+					</div>
+				</td></tr>
 				<tr class="systemsTable">
 					<th class="systemsTable">Node Hostname</th>
 					<th class="systemsTable">Root Password</th>
@@ -2700,62 +2700,62 @@
 <div metal:define-macro="fencedev-instance-cond-ladder"
 	tal:condition="exists: cur_fence_type">
 
-    <tal:block tal:condition="python: cur_fence_type == 'fence_apc'">
+	<tal:block tal:condition="python: cur_fence_type == 'fence_apc'">
 		<tal:block
 			metal:use-macro="here/form-macros/macros/fence-instance-form-apc" />
 	</tal:block>
 
-    <tal:block tal:condition="python: cur_fence_type == 'fence_mcdata'">
+	<tal:block tal:condition="python: cur_fence_type == 'fence_mcdata'">
 		<tal:block
 			metal:use-macro="here/form-macros/macros/fence-instance-form-mcdata" />
 	</tal:block>
 
-    <tal:block tal:condition="python: cur_fence_type == 'fence_wti'">
+	<tal:block tal:condition="python: cur_fence_type == 'fence_wti'">
 		<tal:block
 			metal:use-macro="here/form-macros/macros/fence-instance-form-wti" />
 	</tal:block>
 
-    <tal:block tal:condition="python: cur_fence_type == 'fence_brocade'">
+	<tal:block tal:condition="python: cur_fence_type == 'fence_brocade'">
 		<tal:block
 			metal:use-macro="here/form-macros/macros/fence-instance-form-brocade" />
 	</tal:block>
 
-    <tal:block tal:condition="python: cur_fence_type == 'fence_sanbox2'">
+	<tal:block tal:condition="python: cur_fence_type == 'fence_sanbox2'">
 		<tal:block
 			metal:use-macro="here/form-macros/macros/fence-instance-form-sanbox2" />
 	</tal:block>
 
-    <tal:block tal:condition="python: cur_fence_type == 'fence_vixel'">
+	<tal:block tal:condition="python: cur_fence_type == 'fence_vixel'">
 		<tal:block
 			metal:use-macro="here/form-macros/macros/fence-instance-form-vixel" />
 	</tal:block>
 
-    <tal:block tal:condition="python: cur_fence_type == 'fence_gnbd'">
+	<tal:block tal:condition="python: cur_fence_type == 'fence_gnbd'">
 		<tal:block
 			metal:use-macro="here/form-macros/macros/fence-instance-form-gnbd" />
 	</tal:block>
 
-    <tal:block tal:condition="python: cur_fence_type == 'fence_egenera'">
+	<tal:block tal:condition="python: cur_fence_type == 'fence_egenera'">
 		<tal:block
 			metal:use-macro="here/form-macros/macros/fence-instance-form-egenera" />
 	</tal:block>
 
-    <tal:block tal:condition="python: cur_fence_type == 'fence_bullpap'">
+	<tal:block tal:condition="python: cur_fence_type == 'fence_bullpap'">
 		<tal:block
 			metal:use-macro="here/form-macros/macros/fence-instance-form-bullpap" />
 	</tal:block>
 
-    <tal:block tal:condition="python: cur_fence_type == 'fence_scsi'">
+	<tal:block tal:condition="python: cur_fence_type == 'fence_scsi'">
 		<tal:block
 			metal:use-macro="here/form-macros/macros/fence-instance-form-scsi" />
 	</tal:block>
 
-    <tal:block tal:condition="python: cur_fence_type == 'fence_xvm'">
+	<tal:block tal:condition="python: cur_fence_type == 'fence_xvm'">
 		<tal:block
 			metal:use-macro="here/form-macros/macros/fence-instance-form-xvm" />
 	</tal:block>
 
-    <tal:block tal:condition="python: cur_fence_type == 'fence_bladecenter'">
+	<tal:block tal:condition="python: cur_fence_type == 'fence_bladecenter'">
 		<tal:block
 			metal:use-macro="here/form-macros/macros/fence-instance-form-bladecenter" />
 	</tal:block>
@@ -3738,8 +3738,10 @@
 		<tal:block tal:repeat="gr global_resources">
 			<tal:block tal:define="
 				global res gr;
-				global type res/type;
+				global type python: 'tag_name' in res and res['tag_name'] or '';
 				global resourceIsRef python: True" />
+				<span tal:content="type" />
+				<span tal:content="res" />
 
 			<tal:block metal:use-macro="here/form-macros/macros/serviceconfig-type-macro" />
 		</tal:block>
@@ -3790,45 +3792,55 @@
 </div>
 
 <div metal:define-macro="serviceconfig-type-macro" tal:omit-tag="">
-	<tal:block tal:condition="python: type == 'ip' or type == 'IP Address: '">
-		<tal:block
-			metal:use-macro="here/resource-form-macros/macros/ip_macro" />
+	<tal:block tal:condition="python: type == 'ip'">
+		<div metal:use-macro="here/resource-form-macros/macros/ip_macro" />
 	</tal:block>
 
-	<tal:block tal:condition="python: type == 'fs' or type == 'File System: '">
-		<tal:block
-			metal:use-macro="here/resource-form-macros/macros/fs_macro" />
+	<tal:block tal:condition="python: type == 'fs'">
+		<div metal:use-macro="here/resource-form-macros/macros/fs_macro" />
 	</tal:block>
 
-	<tal:block tal:condition="python: type == 'gfs' or type == 'GFS: '">
-		<tal:block
-			metal:use-macro="here/resource-form-macros/macros/gfs_macro" />
+	<tal:block tal:condition="python: type == 'gfs' or type == 'clusterfs'">
+		<div metal:use-macro="here/resource-form-macros/macros/gfs_macro" />
 	</tal:block>
 
-	<tal:block tal:condition="python: type == 'nfsm' or type == 'NFS Mount: '">
-		<tal:block
-			metal:use-macro="here/resource-form-macros/macros/nfsm_macro" />
+	<tal:block tal:condition="python: type == 'nfsm'">
+		<div metal:use-macro="here/resource-form-macros/macros/nfsm_macro"/>
 	</tal:block>
 
-	<tal:block tal:condition="python: type == 'nfsx' or type == 'NFS Export: '">
-		<tal:block
-			metal:use-macro="here/resource-form-macros/macros/nfsx_macro" />
+	<tal:block tal:condition="python: type == 'nfsx'">
+		<div metal:use-macro="here/resource-form-macros/macros/nfsx_macro"/>
 	</tal:block>
 
-	<tal:block tal:condition="python: type == 'nfsc' or type == 'NFS Client: '">
-		<tal:block
-			metal:use-macro="here/resource-form-macros/macros/nfsc_macro" />
+	<tal:block tal:condition="python: type == 'nfsc'">
+		<div metal:use-macro="here/resource-form-macros/macros/nfsc_macro"/>
 	</tal:block>
 
-	<tal:block
-		tal:condition="python: type == 'smb' or type == 'Samba Service: '">
-		<tal:block
-			metal:use-macro="here/resource-form-macros/macros/smb_macro" />
+	<tal:block tal:condition="python: type == 'smb'">
+		<div metal:use-macro="here/resource-form-macros/macros/smb_macro" />
 	</tal:block>
 
-	<tal:block tal:condition="python: type == 'script' or type == 'Script: '">
-		<tal:block
-			metal:use-macro="here/resource-form-macros/macros/scr_macro" />
+	<tal:block tal:condition="python: type == 'script'">
+		<div metal:use-macro="here/resource-form-macros/macros/scr_macro" />
+	</tal:block>
+
+	<tal:block tal:condition="python: type == 'apache'">
+		<div metal:use-macro="here/resource-form-macros/macros/apache_macro" />
+	</tal:block>
+
+	<tal:block tal:condition="python: type == 'openldap'">
+		<div metal:use-macro="here/resource-form-macros/macros/openldap_macro" />
+	</tal:block>
+
+	<tal:block tal:condition="python: type == 'mysql'">
+		<div metal:use-macro="here/resource-form-macros/macros/mysql_macro" />
+	</tal:block>
+
+	<tal:block tal:condition="python: type == 'postgres-8'">
+		<div metal:use-macro="here/resource-form-macros/macros/postgres-8_macro" />
+	</tal:block>
+	<tal:block tal:condition="python: type == 'tomcat-5'">
+		<div metal:use-macro="here/resource-form-macros/macros/tomcat-5_macro" />
 	</tal:block>
 </div>
 
@@ -3930,7 +3942,7 @@
 			tal:replace="structure python: '<div class=nothing>'" />
 
 		<tal:block tal:define="
-			global type res/type;
+			global type python: 'tag_name' in res and res['tag_name'] or '';
 			global resourceIsRef res/ref_object | nothing" />
 
 		<tal:block metal:use-macro="here/form-macros/macros/serviceconfig-type-macro" />
@@ -3979,9 +3991,11 @@
 		<tal:block tal:repeat="gr global_resources">
 			<tal:block tal:define="
 				global res gr;
-				global type res/type;
+				global type python: 'tag_name' in res and res['tag_name'] or '';
 				global resourceIsRef python: True" />
 
+				<span tal:content="type" />
+				<span tal:content="res" />
 			<tal:block metal:use-macro="here/form-macros/macros/serviceconfig-type-macro" />
 		</tal:block>
 	</div>
@@ -4238,12 +4252,12 @@
 
 	<tal:block tal:condition="exists: fencedevs/fencedevs">
 		<table class="systemsTable">
-	        <thead class="systemsTable">
+			<thead class="systemsTable">
 				<tr class="systemsTable">
 					<th class="systemsTable" width="100">Name</th>
 					<th class="systemsTable" width="100">Type</th>
 					<th class="systemsTable" width="75">Configure</th>
-            	</tr>
+				</tr>
 			</thead>
 			<tr class="systemsTable" tal:repeat="f fencedevs/fencedevs">
 				<td class="systemsTable" tal:content="f/name | string:[unknown]"/>
@@ -4334,7 +4348,7 @@
 		<tal:block metal:use-macro="here/form-macros/macros/fence-form-manual" />
 	</tal:block>
 
-    <tal:block tal:condition="exists:cur_fencedev/unknown">
+	<tal:block tal:condition="exists:cur_fencedev/unknown">
 		<tal:block metal:use-macro="here/form-macros/macros/fence-form-unknown" />
 	</tal:block>
 </div>
@@ -4376,7 +4390,7 @@
 				tal:attributes="value request/clustername" />
 			<input type="hidden" name="orig_name"
 				tal:attributes="value request/fencename"/>
-  			<input type="hidden" name="fencename"
+			<input type="hidden" name="fencename"
 				tal:attributes="value request/fencename" />
 
 			<div class="hbSubmit">
@@ -4408,22 +4422,28 @@
 <div metal:define-macro="conf_editor-form">
 	<h2>Edit cluster.conf</h2>
 	<form method="post"
-	      tal:attributes="action python: './?' + request['QUERY_STRING']"
-	      tal:define="ret python: here.process_cluster_conf_editor(request)">
-	  <span tal:content="structure python: ret['msg'].replace('\n', '<br/>')"/>
-	  <textarea name="new_cluster_conf"
-		    tal:attributes="rows python: len(ret['cluster_conf'].splitlines()) + 8"
-		    tal:content="structure ret/cluster_conf"></textarea>
-	  <input tal:attributes="type  string:hidden;
-	                         name  string:pagetype;
-	                         value python:request['pagetype']"/>
-	  <input tal:attributes="type  string:hidden;
-	                         name  string:clustername;
-	                         value python:request['clustername']"/>
-	  <input type="button" 
-	         value="Reset"
-	         tal:attributes="onclick python:'window.location.assign(\'./?pagetype=' + request['pagetype'] + '&clustername=' + request['clustername'] + '\')'"/>
-	  <input type="submit" value="Propagate"/>
+		tal:attributes="action python: './?' + request['QUERY_STRING']"
+		tal:define="ret python: here.process_cluster_conf_editor(request)">
+
+	<span tal:content="structure python: ret['msg'].replace('\n', '<br/>')" />
+
+	<textarea name="new_cluster_conf"
+		tal:attributes="rows python: len(ret['cluster_conf'].splitlines()) + 8"
+		tal:content="structure ret/cluster_conf">
+	</textarea>
+
+	<input type="hidden" name="pagetype"
+		 tal:attributes="
+			value request/pagetype | nothing" />
+
+	<input type="hidden" name="clustername"
+		tal:attributes="
+			value request/clustername | nothing" />
+
+	<input type="button" value="Reset"
+		tal:attributes="onclick python:'window.location.assign(\'./?pagetype=' + request['pagetype'] + '&clustername=' + request['clustername'] + '\')'" />
+
+	<input type="submit" value="Propagate" />
 	</form>
 </div>
 
--- conga/luci/cluster/resource-form-macros	2007/01/22 17:05:59	1.29
+++ conga/luci/cluster/resource-form-macros	2007/01/26 17:56:14	1.30
@@ -281,66 +281,17 @@
 	</script>
 
 	<tal:block tal:define="global resourcename request/resourcename | request/form/resourceName | nothing" />
+
 	<tal:block tal:condition="resourcename"
 		tal:define="
 			global res python: here.getResourceInfo(modelb, request);
 			global type python: 'tag_name' in res and res['tag_name'] or ''">
 
 	<h2>Configure <span tal:replace="res/name | string: resource" /></h2>
+	<br/>
 
-	<div class="reschoose">
-		<tal:block tal:condition="python: type == 'ip'">
-			<div metal:use-macro="here/resource-form-macros/macros/ip_macro" />
-		</tal:block>
-
-		<tal:block tal:condition="python: type == 'fs'">
-			<div metal:use-macro="here/resource-form-macros/macros/fs_macro" />
-		</tal:block>
-
-		<tal:block tal:condition="python: type == 'gfs' or type == 'clusterfs'">
-			<div metal:use-macro="here/resource-form-macros/macros/gfs_macro" />
-		</tal:block>
-
-		<tal:block tal:condition="python: type == 'nfsm'">
-			<div metal:use-macro="here/resource-form-macros/macros/nfsm_macro"/>
-		</tal:block>
-
-		<tal:block tal:condition="python: type == 'nfsx'">
-			<div metal:use-macro="here/resource-form-macros/macros/nfsx_macro"/>
-		</tal:block>
-
-		<tal:block tal:condition="python: type == 'nfsc'">
-			<div metal:use-macro="here/resource-form-macros/macros/nfsc_macro"/>
-		</tal:block>
-
-		<tal:block tal:condition="python: type == 'smb'">
-			<div metal:use-macro="here/resource-form-macros/macros/smb_macro" />
-		</tal:block>
-
-		<tal:block tal:condition="python: type == 'script'">
-			<div metal:use-macro="here/resource-form-macros/macros/scr_macro" />
-		</tal:block>
-
-		<tal:block tal:condition="python: type == 'apache'">
-			<div metal:use-macro="here/resource-form-macros/macros/apache_macro" />
-		</tal:block>
-
-		<tal:block tal:condition="python: type == 'openldap'">
-			<div metal:use-macro="here/resource-form-macros/macros/openldap_macro" />
-		</tal:block>
-
-		<tal:block tal:condition="python: type == 'mysql'">
-			<div metal:use-macro="here/resource-form-macros/macros/mysql_macro" />
-		</tal:block>
-
-		<tal:block tal:condition="python: type == 'postgres-8'">
-			<div metal:use-macro="here/resource-form-macros/macros/postgres-8_macro" />
-		</tal:block>
-
-		<tal:block tal:condition="python: type == 'tomcat-5'">
-			<div metal:use-macro="here/resource-form-macros/macros/tomcat-5_macro" />
-		</tal:block>
-	</div>
+	<div class="reschoose"
+		metal:use-macro="here/form-macros/macros/serviceconfig-type-macro" />
 	</tal:block>
 </div>
 
--- conga/luci/cluster/resource_form_handlers.js	2007/01/22 17:06:00	1.28
+++ conga/luci/cluster/resource_form_handlers.js	2007/01/26 17:56:14	1.29
@@ -279,7 +279,10 @@
 	var errors = check_form(form);
 	if (error_dialog(errors))
 		return (-1);
-	form.submit();
+
+	var confirm_str = form.edit ? 'Update this resource?' : 'Add this resource?';
+	if (confirm(confirm_str))
+		form.submit();
 }
 
 function delete_resource(form) {
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2007/01/24 19:45:44	1.211
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2007/01/26 17:56:14	1.212
@@ -5050,6 +5050,7 @@
 		itemmap['name'] = item.getName()
 		itemmap['attrs'] = item.attr_hash
 		itemmap['type'] = item.resource_type
+		itemmap['tag_name'] = item.TAG_NAME
 		itemmap['cfgurl'] = baseurl + "?" + "clustername=" + cluname + "&resourcename=" + item.getName() + "&pagetype=" + RESOURCE_CONFIG
 		itemmap['url'] = baseurl + "?" + "clustername=" + cluname + "&resourcename=" + item.getName() + "&pagetype=" + RESOURCE
 		itemmap['delurl'] = baseurl + "?" + "clustername=" + cluname + "&resourcename=" + item.getName() + "&pagetype=" + RESOURCE_REMOVE
@@ -5264,7 +5265,7 @@
 		return errstr
 
 	try:
-		set_node_flag(self, clustername, ragent, str(batch_number), RESOURCE_REMOVE, "Removing Resource \'%s\'" % request['resourcename'])
+		set_node_flag(self, clustername, ragent, str(batch_number), RESOURCE_REMOVE, "Removing resource \'%s\'" % request['resourcename'])
 	except Exception, e:
 		luci_log.debug_verbose('delResource7: failed to set flags: %s' % str(e))
 
@@ -6593,7 +6594,17 @@
 		res_name = res.attr_hash['address']
 
 	try:
-		set_node_flag(self, clustername, ragent, str(batch_number), RESOURCE_ADD, "Creating New Resource \'%s\'" % res_name)
+		try:
+			if request.form.has_key('edit'):
+				action_type = RESOURCE_CONFIG
+				action_str = 'Configuring resource \"%s\"' % res_name
+			else:
+				raise Exception, 'new'
+		except Exception, e:
+			action_type = RESOURCE_ADD
+			action_str = 'Creating new resource \"%s\"' % res_name
+
+		set_node_flag(self, clustername, ragent, str(batch_number), action_type, action_str)
 	except Exception, e:
 		luci_log.debug_verbose('addResource7: failed to set flags: %s' % str(e))
 


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