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

rmccabe at sourceware.org rmccabe at sourceware.org
Wed Dec 6 22:44:18 UTC 2006


CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2006-12-06 22:44:18

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

Log message:
	more svc autostart fixes

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.124&r2=1.125
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.24&r2=1.25
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.175&r2=1.176

--- conga/luci/cluster/form-macros	2006/12/06 22:11:20	1.124
+++ conga/luci/cluster/form-macros	2006/12/06 22:44:18	1.125
@@ -2918,7 +2918,7 @@
 		<input type="hidden" name="parent_uuid" value="_toplevel" />
 		<input type="hidden" name="tree_level" value="-1" />
 		<input type="hidden" name="svc_name" value="" />
-		<input type="hidden" name="autostart" value="" />
+		<input type="hidden" name="autostart" value="-1" />
 		<input type="hidden" name="form_xml" />
 		<input type="hidden" name="action" value="add" />
 		</form>
@@ -3135,7 +3135,8 @@
 				<tr><td>
 				Automatically start this service
 				</td>
-				<td><input type="checkbox" name="autostart" tal:attributes="checked sinfo/autostart | nothing" /></td></tr>
+				<td><input type="checkbox" name="autostart"
+						tal:attributes="checked python: ('autostart' in sinfo and sinfo['autostart'].lower() != 'false') and 'checked'" /></td></tr>
 			</table>
 			<input type="hidden" name="service_name"
 				tal:attributes="value sinfo/name | string:1" />
@@ -3157,7 +3158,7 @@
 		<input type="hidden" name="parent_uuid" value="_toplevel" />
 		<input type="hidden" name="tree_level" value="-1" />
 		<input type="hidden" name="svc_name" value="" />
-		<input type="hidden" name="autostart" value="" />
+		<input type="hidden" name="autostart" value="-1" />
 		<input type="hidden" name="form_xml" />
 		<input type="hidden" name="action" value="edit" />
 		</form>
--- conga/luci/cluster/resource_form_handlers.js	2006/12/05 23:32:34	1.24
+++ conga/luci/cluster/resource_form_handlers.js	2006/12/06 22:44:18	1.25
@@ -444,7 +444,7 @@
 	/* sort this out in the backend */
 	master_form.form_xml.value = '<formlist>' + form_xml + '</formlist>';
 	master_form.svc_name.value = svc_name;
-	master_form.autostart = autostart;
+	master_form.autostart.value = autostart;
 
 	var confirm_msg = null;
 	if (master_form.action.value == 'add')
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/12/06 22:11:20	1.175
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/12/06 22:44:18	1.176
@@ -500,18 +500,19 @@
 
 	autostart = "1"
 	try:
-		if request.form['autostart'] == "0":
+		if not request.form.has_key('autostart') or request.form['autostart'] == "0":
 			autostart = "0"
-	except:
-		pass
+	except Exception, e:
+		autostart = None
+		luci_log.debug_verbose('vSA5a: error getting autostart: %s' % str(e))
 
 	try:
 		cur_service = model.retrieveServiceByName(service_name)
 	except GeneralError, e:
-		luci_log.debug_verbose('vSA5a: no service named %s found' % service_name)
+		luci_log.debug_verbose('vSA5b: no service named %s found' % service_name)
 		cur_service = None
 	except Exception, e:
-		luci_log.debug_verbose('vSA5a: no service named %s found: %s' % (service_name, str(e)))
+		luci_log.debug_verbose('vSA5c: no service named %s found: %s' % (service_name, str(e)))
 		cur_service = None
 
 	try:
@@ -543,7 +544,8 @@
 
 	new_service = Service()
 	new_service.addAttribute('name', service_name)
-	new_service.attr_hash['autostart'] = autostart
+	if autostart is not None:
+		new_service.attr_hash['autostart'] = autostart
 
 	buildSvcTree(new_service, form_hash['toplevel']['kids'])
 	model.resourcemanager_ptr.addChild(new_service)




More information about the Cluster-devel mailing list