All of lore.kernel.org
 help / color / mirror / Atom feed
From: kupcevic@sourceware.org <kupcevic@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci cluster/form-chooser cluster/form-m ...
Date: 21 Dec 2006 21:26:21 -0000	[thread overview]
Message-ID: <20061221212621.3296.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	kupcevic at 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'



             reply	other threads:[~2006-12-21 21:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-21 21:26 kupcevic [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-09-25 22:47 [Cluster-devel] conga/luci cluster/form-chooser cluster/form-m rmccabe
2007-03-12  4:25 rmccabe
2007-03-12  4:24 rmccabe
2007-03-12  4:22 rmccabe
2007-02-23 22:07 rmccabe
2006-12-07 17:54 rmccabe
2006-12-06 18:38 rmccabe
2006-11-10 19:44 rmccabe
2006-10-09 17:12 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=20061221212621.3296.qmail@sourceware.org \
    --to=kupcevic@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.