Skip to contentSkip to conversation

conga/luci cluster/form-macros cluster/validat ...

Cluster-devel [email protected] 1 participant 1 message Feb 24, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2007-02-24 07:02:42

Modified files:
luci/cluster : form-macros validate_sys_svc.js
luci/site/luci/Extensions: ricci_bridge.py system_adapters.py

Log message:
Cleanups to the system services management interface

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.193&r2=1.194
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_sys_svc.js.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_bridge.py.diff?cvsroot=cluster&r1=1.59&r2=1.60
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/system_adapters.py.diff?cvsroot=cluster&r1=1.1&r2=1.2

luci/cluster/form-macros +1 -1
@@ -5062,7 +5062,7 @@
 			<td class="systemsTable">
 				<span
 					tal:content="s/state |string:[unknown]"
-					tal:attributes="id python: '__STATUS__:' + s['name']" />
+					tal:attributes="id python: '__STATUS__' + s['name']" />
 			</td>
 
 			<td class="systemsTable">
luci/cluster/validate_sys_svc.js +36 -7

52 lines not on this page · raw message

luci/site/luci/Extensions/ricci_bridge.py +23 -8
@@ -491,16 +491,15 @@
 
 	doc = minidom.Document()
 	elem = doc.createElement('result')
+	elem.setAttribute('success', '0')
 
 	if not servicename:
 		elem.setAttribute('service', 'No service name was specified.')
 		elem.setAttribute('message', 'No service name was specified.')
-		elem.setAttribute('success', '0')
 
 	if not op:
 		elem.setAttribute('operation', 'No operation was specified.')
 		elem.setAttribute('message', 'No operation was specified.')
-		elem.setAttribute('success', '0')
 
 	if not servicename or not op:
 		doc.appendChild(elem)
@@ -517,8 +516,7 @@
 		else:
 			raise Exception, op
 	except Exception, e:
-		elem.setAttribute('success', '0');
-		elem.setAttribute('message', 'Unknown operation')
+		elem.setAttribute('message', 'Unknown operation: %s' % str(e))
 		doc.appendChild(elem)
 		return doc
 
@@ -526,14 +524,31 @@
 		
 	ricci_xml = rc.batch_run(batch_str, async=False)
 	if not ricci_xml or not ricci_xml.firstChild:
-		luci_log.debug_verbose('SVCM0: None returned')
-		elem.setAttribute('success', '0')
 		elem.setAttribute('message', 'operation failed')
 		doc.appendChild(elem)
 		return doc
 
-	elem.setAttribute('success', '0')
-	elem.setAttribute('message', str(ricci_xml.toxml()))
+	try:
+		mod_elem = ricci_xml.getElementsByTagName('module')
+		status_code = int(mod_elem[0].getAttribute('status'))
+		if status_code == 0:
+			var_elem = mod_elem[0].getElementsByTagName('var')
+			for i in var_elem:
+				name = i.getAttribute('name').lower()
+				if name == 'success':
+					success = i.getAttribute('value').lower()
+					if success == 'true':
+						elem.setAttribute('success', '1')
+						elem.setAttribute('message', 'success')
+					else:
+						elem.setAttribute('message', 'operation failed')
+					break
+		else:
+			err_msg = mod_elem[0].childNodes[1].getAttribute('description')
+			elem.setAttribute('message', err_msg)
+	except Exception, e:
+		elem.setAttribute('message', 'operation failed')
+
 	doc.appendChild(elem)
 	return doc
 
luci/site/luci/Extensions/system_adapters.py +32 -17

69 lines not on this page · raw message