[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:	rmccabe sourceware org	2006-11-10 19:44:57

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

Log message:
	- fix the redirection upon completion of async ricci tasks
	- fix a bug that caused adding nfs mount resources to fail

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-chooser.diff?cvsroot=cluster&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.102&r2=1.103
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/portlet_cluconfig.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.23&r2=1.24
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.160&r2=1.161

--- conga/luci/cluster/form-chooser	2006/10/16 20:25:33	1.12
+++ conga/luci/cluster/form-chooser	2006/11/10 19:44:57	1.13
@@ -12,7 +12,7 @@
   <span tal:condition="not: busywaiting">
     <span tal:omit-tag="" tal:define="global ptype request/pagetype |nothing"/>
     <span tal:omit-tag="" tal:condition="python: not ptype">
-     <div metal:use-macro="here/form-macros/macros/entry-form"/>
+     <div metal:use-macro="here/form-macros/macros/clusters-form"/>
     </span>
     <span tal:omit-tag="" tal:condition="python: ptype == '0' or ptype == '1' or ptype == '2' or ptype == '3'">
      <div metal:use-macro="here/form-macros/macros/clusters-form"/>
--- conga/luci/cluster/form-macros	2006/11/09 20:32:02	1.102
+++ conga/luci/cluster/form-macros	2006/11/10 19:44:57	1.103
@@ -7,7 +7,6 @@
 <body>
 
 <div metal:define-macro="entry-form">
-	<h2>Entry Form</h2>
 </div>
 
 <div metal:define-macro="busywaitpage">
--- conga/luci/cluster/portlet_cluconfig	2006/09/27 22:24:11	1.2
+++ conga/luci/cluster/portlet_cluconfig	2006/11/10 19:44:57	1.3
@@ -10,7 +10,7 @@
 
 <dl class="portlet" id="portlet-cluconfig-tree">
     <dt class="portletHeader">
-        <a href="#">
+        <a href="/luci/cluster/index_html?pagetype=3">
           Clusters
         </a>
     </dt>
@@ -36,7 +36,8 @@
 
 <dl class="portlet" id="portlet-cluconfig-tree">
     <dt class="portletHeader">
-        <a href="#" tal:attributes="href python:here.getClusterURL(request,modelb)">
+        <a href="/luci/cluster/index_html?pagetype=3"
+			tal:attributes="href python:here.getClusterURL(request,modelb)">
           <div tal:omit-tag="" tal:content="python: here.getClusterAlias(modelb)" />
         </a>
     </dt>
--- conga/luci/cluster/resource-form-macros	2006/11/07 21:33:52	1.23
+++ conga/luci/cluster/resource-form-macros	2006/11/10 19:44:57	1.24
@@ -684,14 +684,12 @@
 				<input type="radio" name="nfstype" value="nfs"
 					tal:attributes="
 						disabled python: editDisabled;
-						content string: NFS (version 3);
-						checked python: nfstype == 'nfs' and 'checked'" />
+						checked python: nfstype != 'nfs4' and 'checked'" />NFS3
 				<br/>
 				<input type="radio" name="nfstype" value="nfs4"
 					tal:attributes="
 						disabled python: editDisabled;
-						content string: NFS4;
-						checked python: nfstype == 'nfs4' and 'checked'" />
+						checked python: nfstype == 'nfs4' and 'checked'" />NFS4
 			</td>
 		</tr>
 
--- conga/luci/cluster/resource_form_handlers.js	2006/10/30 21:21:16	1.21
+++ conga/luci/cluster/resource_form_handlers.js	2006/11/10 19:44:57	1.22
@@ -101,7 +101,7 @@
 function validate_nfs_mount(form) {
 	var errors = new Array();
 
-	if (!form.mountpoint || str_is_blank(form.mounpoint.value)) {
+	if (!form.mountpoint || str_is_blank(form.mountpoint.value)) {
 		errors.push('No mount point was given.');
 		set_form_err(form.mountpoint);
 	} else
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/11/10 18:18:09	1.160
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/11/10 19:44:57	1.161
@@ -901,13 +901,13 @@
   cname = None
   try:
     cname = request[CLUNAME]
-  except KeyError, e:
+  except:
     cname = ""
 
   try:
     url = request['URL']
-  except KeyError, e:
-    url = "."
+  except:
+    url = "/luci/cluster/index_html"
 
   try:
     pagetype = request[PAGETYPE]
@@ -998,13 +998,13 @@
   #There should be a positive page type
   try:
     pagetype = request[PAGETYPE]
-  except KeyError, e:
+  except:
     pagetype = '3'
 
   try:
     url = request['URL']
   except KeyError, e:
-    url = "."
+    url = "/luci/cluster/index_html"
 
   #The only way this method can run is if there exists
   #a clustername query var
@@ -1444,7 +1444,7 @@
     else:
       selectedtab = "homebase"
   except KeyError, e:
-    pass
+    selectedtab = None
 
   htab = { 'Title':"homebase",
            'Description':"Home base for this luci server",
@@ -1457,7 +1457,7 @@
 
   ctab = { 'Title':"cluster",
            'Description':"Cluster configuration page",
-           'Taburl':"/luci/cluster?pagetype=3"}
+           'Taburl':"/luci/cluster/index_html?pagetype=3"}
   if selectedtab == "cluster":
     ctab['isSelected'] = True
   else:
@@ -1633,18 +1633,18 @@
 		baseurl = req['URL']
 		if not baseurl:
 			raise KeyError, 'is blank'
-	except KeyError, e:
-		baseurl = '.'
+	except:
+		baseurl = '/luci/cluster/index_html'
 
 	try:
 		cluname = req['clustername']
 		if not cluname:
 			raise KeyError, 'is blank'
-	except KeyError, e:
+	except:
 		try:
 			cluname = req.form['clusterName']
 			if not cluname:
-				raise
+				raise KeyError, 'is blank'
 		except:
 			cluname = '[error retrieving cluster name]'
 
@@ -1678,8 +1678,8 @@
 		baseurl = req['URL']
 		if not baseurl:
 			raise KeyError, 'is blank'
-	except KeyError, e:
-		baseurl = '.'
+	except:
+		baseurl = '/luci/cluster/index_html'
 
 	try:
 		cluname = req['clustername']
@@ -1835,7 +1835,7 @@
 		luci_log.debug_verbose('startService4: error setting flags for service %s at node %s for cluster %s' % (svcname, nodename, cluname))
 
 	response = req.RESPONSE
-	response.redirect(req['HTTP_REFERER'] + "&busyfirst=true")
+	response.redirect(req['URL'] + "?pagetype=" + SERVICE_LIST + "&clustername=" + cluname + '&busyfirst=true')
 
 def serviceRestart(self, rc, req):
 	svcname = None
@@ -1875,7 +1875,7 @@
 		luci_log.debug_verbose('serviceRestart3: error setting flags for service %s for cluster %s' % (svcname, cluname))
 
 	response = req.RESPONSE
-	response.redirect(req['HTTP_REFERER'] + "&busyfirst=true")
+	response.redirect(req['URL'] + "?pagetype=" + SERVICE_LIST + "&clustername=" + cluname + '&busyfirst=true')
 
 def serviceStop(self, rc, req):
 	svcname = None
@@ -1915,7 +1915,7 @@
 		luci_log.debug_verbose('serviceStop3: error setting flags for service %s for cluster %s' % (svcname, cluname))
 
 	response = req.RESPONSE
-	response.redirect(req['HTTP_REFERER'] + "&busyfirst=true")
+	response.redirect(req['URL'] + "?pagetype=" + SERVICE_LIST + "&clustername=" + cluname + '&busyfirst=true')
 
 def getFdomsInfo(self, modelb, request, clustatus):
   slist = list()
@@ -2031,7 +2031,7 @@
 
 	response = request.RESPONSE
 	response.redirect('%s?pagetype=%s&clustername=%s&busyfirst=true' \
-		 % (request['URL'], CLUSTER, model.getClusterName()))
+		 % (request['URL'], NODES, model.getClusterName()))
 
 def getClusterInfo(self, model, req):
   try:
@@ -2638,39 +2638,35 @@
 			luci_log.debug_verbose('NTP: nodeLeave failed')
 			return None
 
-		#Is this correct? Should we re-direct to the cluster page?
 		response = request.RESPONSE
-		response.redirect(request['URL'] + "?pagetype=" + CLUSTER_CONFIG + "&clustername=" + clustername)
+		response.redirect(request['URL'] + "?pagetype=" + NODE_LIST + "&clustername=" + clustername + '&busyfirst=true')
 	elif task == NODE_JOIN_CLUSTER:
 		if nodeJoin(self, rc, clustername, nodename_resolved) is None:
 			luci_log.debug_verbose('NTP: nodeJoin failed')
 			return None
 
-		#Once again, is this correct? Should we re-direct to the cluster page?
 		response = request.RESPONSE
-		response.redirect(request['URL'] + "?pagetype=" + CLUSTER_CONFIG + "&clustername=" + clustername)
+		response.redirect(request['URL'] + "?pagetype=" + NODE_LIST + "&clustername=" + clustername + '&busyfirst=true')
 	elif task == NODE_REBOOT:
 		if forceNodeReboot(self, rc, clustername, nodename_resolved) is None:
 			luci_log.debug_verbose('NTP: nodeReboot failed')
 			return None
 
-		#Once again, is this correct? Should we re-direct to the cluster page?
 		response = request.RESPONSE
-		response.redirect(request['URL'] + "?pagetype=" + CLUSTER_CONFIG + "&clustername=" + clustername)
+		response.redirect(request['URL'] + "?pagetype=" + NODE_LIST + "&clustername=" + clustername + '&busyfirst=true')
 	elif task == NODE_FENCE:
 		if forceNodeFence(self, clustername, nodename, nodename_resolved) is None:
 			luci_log.debug_verbose('NTP: nodeFencefailed')
 			return None
 
-		#Once again, is this correct? Should we re-direct to the cluster page?
 		response = request.RESPONSE
-		response.redirect(request['URL'] + "?pagetype=" + CLUSTER_CONFIG + "&clustername=" + clustername)
+		response.redirect(request['URL'] + "?pagetype=" + NODE_LIST + "&clustername=" + clustername + '&busyfirst=true')
 	elif task == NODE_DELETE:
 		if nodeDelete(self, rc, model, clustername, nodename, nodename_resolved) is None:
 			luci_log.debug_verbose('NTP: nodeDelete failed')
 			return None
 		response = request.RESPONSE
-		response.redirect(request['HTTP_REFERER'] + "&busyfirst=true")
+		response.redirect(request['URL'] + "?pagetype=" + NODE_LIST + "&clustername=" + clustername + '&busyfirst=true')
 
 def getNodeInfo(self, model, status, request):
   infohash = {}
@@ -3360,7 +3356,7 @@
     luci_log.debug('ICB5: An error occurred while looking for cluster %s flags at path %s' % (cluname, path))
     return map
 
-  luci_log.debug_verbose('ICB6: isClusterBusy: %s is busy: %d flags' \
+  luci_log.debug_verbose('ICB6: %s is busy: %d flags' \
       % (cluname, len(items)))
   map['busy'] = "true"
   #Ok, here is what is going on...if there is an item,
@@ -3541,7 +3537,7 @@
         try:
             clusterfolder.manage_delObjects(item[0])
         except Exception, e:
-            luci_log.info('Unable to delete %s: %s' % (item[0], str(e)))
+            luci_log.info('ICB16: Unable to delete %s: %s' % (item[0], str(e)))
       else:
         node_report = {}
         map['busy'] = "true"
@@ -3563,7 +3559,12 @@
     map['refreshurl'] = "5; url=" + wholeurl
     req['specialpagetype'] = "1"
   else:
-    map['refreshurl'] = '5; url=\".\"'
+    try:
+      query = req['QUERY_STRING'].replace('&busyfirst=true', '')
+      map['refreshurl'] = '5; url=' + req['ACTUAL_URL'] + '?' + query
+    except:
+      map['refreshurl'] = '5; url=/luci/cluster?pagetype=3'
+  luci_log.debug_verbose('ICB17: refreshurl is \"%s\"' % map['refreshurl'])
   return map
 
 def getClusterOS(self, rc):
@@ -3739,7 +3740,7 @@
 		luci_log.debug_verbose('delResource7: failed to set flags: %s' % str(e))
 
 	response = request.RESPONSE
-	response.redirect(request['HTTP_REFERER'] + "&busyfirst=true")
+	response.redirect(request['URL'] + "?pagetype=" + RESOURCES + "&clustername=" + clustername + '&busyfirst=true')
 
 def addIp(request, form=None):
 	if form is None:
@@ -4452,7 +4453,7 @@
 		luci_log.debug_verbose('addResource7: failed to set flags: %s' % str(e))
 
 	response = request.RESPONSE
-	response.redirect(request['HTTP_REFERER'] + "&busyfirst=true")
+	response.redirect(request['URL'] + "?pagetype=" + RESOURCES + "&clustername=" + clustername + '&busyfirst=true')
 
 def getResourceForEdit(modelb, name):
 	resPtr = modelb.getResourcesPtr()


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