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

[Cluster-devel] conga/luci cluster/form-chooser cluster/form-m ...



CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	kupcevic sourceware org	2006-12-21 21:26:20

Modified files:
	luci/cluster   : form-chooser form-macros 
	luci/site/luci/Extensions: cluster_adapters.py 
	                           conga_constants.py 

Log message:
	luci: cluster.conf editor

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-chooser.diff?cvsroot=cluster&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.136&r2=1.137
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.191&r2=1.192
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_constants.py.diff?cvsroot=cluster&r1=1.31&r2=1.32

--- conga/luci/cluster/form-chooser	2006/12/06 18:38:53	1.14
+++ conga/luci/cluster/form-chooser	2006/12/21 21:26:20	1.15
@@ -152,6 +152,11 @@
     <span tal:omit-tag="" tal:condition="python: ptype == '55'">
      <div metal:use-macro="here/form-macros/macros/fencedevprocess-form"/>
     </span>
+
+    <span tal:omit-tag="" tal:condition="python: ptype == '80'">
+     <div metal:use-macro="here/form-macros/macros/conf_editor-form"/>
+    </span>
+
    </span>
   </metal:choose-form>
   </body>
--- conga/luci/cluster/form-macros	2006/12/21 05:08:48	1.136
+++ conga/luci/cluster/form-macros	2006/12/21 21:26:20	1.137
@@ -825,7 +825,8 @@
 
 			<tbody class="systemsTable">
 				<tr class="systemsTable">
-					<td class="systemsTable">Post Fail Delay</td>
+					<td class="systemsTable">Post Fail <span tal:attributes="onclick python:'window.location.assign(\'./?pagetype=80&clustername=' + request['clustername'] + '\')'">Delay</span>
+					</td>
 					<td class="systemsTable">
 						<input type="text" name="post_fail_delay"
 							tal:attributes="value clusterinfo/pfd" />
@@ -3871,6 +3872,28 @@
 	<h2>Fence Device Process Form</h2>
 </div>
 
+<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"
+		          rows="80"
+		          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"/>
+	</form>
+</div>
+
 
 </body>
 </html>
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/12/21 05:08:49	1.191
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/12/21 21:26:20	1.192
@@ -5799,3 +5799,68 @@
 					% (batch_id, task, desc, objpath, str(e))
 		luci_log.debug_verbose(errmsg)
 		raise Exception, errmsg
+
+
+
+
+
+
+
+
+
+
+
+def process_cluster_conf_editor(self, req):
+	clustername = req['clustername']
+	msg = '\n'
+	cc = ''
+	if 'new_cluster_conf' in req:
+		cc = req['new_cluster_conf']
+		msg += 'Checking if valid XML - '
+		cc_xml = None
+		try:
+			cc_xml = minidom.parseString(cc)
+		except:
+			pass
+		if cc_xml == None:
+			msg += 'FAILED\n'
+			msg += 'Fix the error and try again:\n'
+		else:
+			msg += 'PASSED\n'
+			
+			msg += 'Making sure no clustername change has accured - '
+			new_name = cc_xml.firstChild.getAttribute('name')
+			if new_name != clustername:
+				msg += 'FAILED\n'
+				msg += 'Fix the error and try again:\n'
+			else:
+				msg += 'PASSED\n'
+				
+				msg += 'Increasing cluster version number - '
+				version = cc_xml.firstChild.getAttribute('config_version')
+				version = int(version) + 1
+				cc_xml.firstChild.setAttribute('config_version', str(version))
+				msg += 'DONE\n'
+				
+				msg += 'Propagating new cluster.conf'
+				rc = getRicciAgent(self, clustername)
+				if not rc:
+					luci_log.debug_verbose('VFA: unable to find a ricci agent for the %s cluster' % clustername)
+					msg += '\nUnable to contact a ricci agent for cluster ' + clustername + '\n\n'
+				else:
+					batch_id, result = setClusterConf(rc, cc_xml.toxml())
+					if batch_id is None or result is None:
+						luci_log.debug_verbose('VFA: setClusterConf: batchid or result is None')
+						msg += '\nUnable to propagate the new cluster configuration for ' + clustername + '\n\n'
+					else:	
+						msg += ' - DONE\n'
+						cc = cc_xml.toxml()
+						msg += '\n\nALL DONE\n\n'
+	else:
+		if getClusterInfo(self, None, req) == {}:
+			msg = 'invalid cluster'
+		else:
+			model = req.SESSION.get('model')
+			cc = model.exportModelAsString()
+	return {'msg'              : msg,
+		'cluster_conf'     : cc}
--- conga/luci/site/luci/Extensions/conga_constants.py	2006/12/21 03:42:49	1.31
+++ conga/luci/site/luci/Extensions/conga_constants.py	2006/12/21 21:26:20	1.32
@@ -46,6 +46,8 @@
 SERVICE_DELETE = '56'
 FENCEDEV_DELETE = "57"
 
+CONF_EDITOR = '80'
+
 #Cluster tasks
 CLUSTER_STOP = '1000'
 CLUSTER_START = '1001'


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