Skip to contentSkip to conversation

conga/luci cluster/form-macros site/luci/Exten ...

Cluster-devel [email protected] 1 participant 1 message Nov 13, 2006

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-11-13 21:40:55

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

Log message:
fix for bz# 215034 (Cannot change daemon properties via luci web app)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.104&r2=1.105
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.162&r2=1.163
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_constants.py.diff?cvsroot=cluster&r1=1.25&r2=1.26
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_bridge.py.diff?cvsroot=cluster&r1=1.42&r2=1.43

luci/cluster/form-macros +22 -7
@@ -1791,7 +1791,7 @@
 		tal:condition="python: nodeinfo['nodestate'] == '0' or nodeinfo['nodestate'] == '1'">
 
 	<h3>Cluster daemons running on this node</h3>
-	<form name="daemon_form">
+	<form name="daemon_form" method="post">
 	<table class="systemsTable">
 		<thead>
 			<tr class="systemsTable">
@@ -1803,23 +1803,38 @@
 		<tfoot class="systemsTable">
 			<tr class="systemsTable"><td class="systemsTable" colspan="3">
 				<div class="systemsTableEnd">
-					<input type="button" value="Update node daemon properties" />
+					<input type="Submit" value="Update node daemon properties" />
 				</div>
 			</td></tr>
 		</tfoot>
 		<tbody class="systemsTable">
 			<tr class="systemsTable" tal:repeat="demon nodeinfo/d_states">
 				<td class="systemsTable"><span tal:replace="demon/name"/></td>
-				<td class="systemsTable"><span tal:replace="python: demon['running'] and 'yes' or 'no'" /></td>
+				<td class="systemsTable"><span tal:replace="python: demon['running'] == 'true' and 'yes' or 'no'" /></td>
 				<td class="systemsTable">
-					<input type="checkbox"
-						tal:attributes="
-							name python: nodeinfo['nodename'] + ':' + demon['name'];
-							checked python: demon['enabled'] and 'checked'" />
+					<input type="hidden" tal:attributes="
+						name python: '__daemon__:' + demon['name'] + ':';
+						value demon/name" />
+
+					<input type="hidden" tal:attributes="
+						name python: '__daemon__:' + demon['name'] + ':';
+						value python: demon['enabled'] == 'true' and '1' or '0'" />
+
+					<input type="checkbox" tal:attributes="
+						name python: '__daemon__:' + demon['name'] + ':';
+						checked python: demon['enabled'] == 'true' and 'checked'" />
 				</td>
 			</tr>
 		</tbody>
 	</table>
+
+	<input type="hidden" name="nodename"
+		tal:attributes="value nodeinfo/nodename | request/nodename | nothing" />
+
+	<input type="hidden" name="clustername"
+		tal:attributes="value request/clustername | nothing" />
+
+	<input type="hidden" name="pagetype" value="55" />
 	</form>
 	<hr/>
 	</tal:block>
luci/site/luci/Extensions/cluster_adapters.py +95 -5

140 lines not on this page · raw message

luci/site/luci/Extensions/conga_constants.py +1 -0
@@ -42,6 +42,7 @@
 FENCEDEV_LIST="52"
 FENCEDEV_CONFIG="53"
 FENCEDEV="54"
+CLUSTER_DAEMON="55"
 
 #Cluster tasks
 CLUSTER_STOP = '1000'
luci/site/luci/Extensions/ricci_bridge.py +21 -1
@@ -18,7 +18,7 @@
 		return False
 
 	try:
-		batchid = batch.getAttribute('batch_id')
+		dummy = batch.getAttribute('batch_id')
 		result = batch.getAttribute('status')
 	except:
 		return False
@@ -471,6 +471,26 @@
 	ricci_xml = rc.batch_run(batch_str)
 	return batchAttemptResult(ricci_xml)
 
+def updateServices(rc, enable_list, disable_list):
+	batch = ''
+
+	if enable_list and len(enable_list) > 0:
+		batch += '<module name="service"><request API_version="1.0"><function_call name="enable"><var mutable="false" name="services" type="list_xml">'
+		for i in enable_list:
+			batch += '<service name="%s"/>' % str(i)
+		batch += '</var></function_call></request></module>'
+
+	if disable_list and len(disable_list) > 0:
+		batch += '<module name="service"><request API_version="1.0"><function_call name="disable"><var mutable="false" name="services" type="list_xml">'
+		for i in disable_list:
+			batch += '<service name="%s"/>' % str(i)
+		batch += '</var></function_call></request></module>'
+
+	if batch == '':
+		return None
+	ricci_xml = rc.batch_run(batch)
+	return batchAttemptResult(ricci_xml)
+	
 def restartService(rc, servicename):
 	batch_str = '<module name="cluster"><request API_version="1.0"><function_call name="restart_service"><var mutable="false" name="servicename" type="string" value=\"' + servicename + '\"/></function_call></request></module>'