conga/luci cluster/form-macros homebase/homeba ...
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2007-07-12 22:35:40
Modified files:
luci/cluster : form-macros
luci/homebase : homebase_common.js luci/plone-custom: conga.js luci/site/luci/Extensions: LuciClusterInfo.py LuciDB.py
PropsObject.py RicciQueries.py cluster_adapters.py ricci_communicator.py
Log message:
Most of the fix for 247521: Luci returns mis-leading errors if cluster.conf has a syntax error
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.203&r2=1.204
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/homebase_common.js.diff?cvsroot=cluster&r1=1.19&r2=1.20
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/plone-custom/conga.js.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciClusterInfo.py.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciDB.py.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/PropsObject.py.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/RicciQueries.py.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.260&r2=1.261
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_communicator.py.diff?cvsroot=cluster&r1=1.28&r2=1.29
luci/cluster/form-macros +8 -2
@@ -122,14 +122,20 @@ </td> </tr> - <tr class="cluster"> - <td tal:condition="exists: cstatus/error" class="cluster"> + <tr class="cluster" tal:condition="exists:cstatus/error"> + <td class="cluster"> <span class="errmsgs"> An error occurred while attempting to get status information for this cluster. The information shown may be stale or inaccurate. </span> </td> </tr> + <tr class="cluster" tal:condition="exists:cstatus/errmsg"> + <td class="cluster"> + <span class="errmsgs" tal:content="cstatus/errmsg" /> + </td> + </tr> + <tr class="cluster info_middle"> <td colspan="2" class="cluster cluster_quorum"> <ul class="cluster_quorum"
luci/homebase/homebase_common.js +0 -8
@@ -108,14 +108,6 @@ } } -function hide_element(id) { - var elem = document.getElementById(id); - if (elem) { - elem.style.visibility = 'hidden'; - elem.style.display = 'none'; - } -} - function isValidHost(str) { var i = str.split('.');
luci/plone-custom/conga.js +8 -0
@@ -11,6 +11,14 @@ return str.replace('&', '&').replace('<', '<').replace('>', '>').replace('"', '"').replace('\'', '''); } +function hide_element(id) { + var elem = document.getElementById(id); + if (elem) { + elem.style.visibility = 'hidden'; + elem.style.display = 'none'; + } +} + function popup_window(url, width_percent, height_percent) { var width = window.innerWidth * (width_percent / 100); var height = window.innerHeight * (height_percent / 100);
luci/site/luci/Extensions/LuciClusterInfo.py +92 -61
255 lines not on this page · raw message
luci/site/luci/Extensions/LuciDB.py +6 -4
@@ -931,7 +931,7 @@ luci_log.debug_verbose('GCF0: cluster %s [%s] folder missing: %r %s -- returning empty map' % (cluname, path, e, str(e))) return None -def getClusterStatusDB(self, clustername): +def getClusterStatusDB(self, clustername, errmsg=None): results = list() vals = {}
@@ -942,12 +942,14 @@ vals['quorate'] = '[unknown]' vals['votes'] = '[unknown]' vals['minQuorum'] = '[unknown]' + if errmsg: + vals['errmsg'] = errmsg results.append(vals) nodelist = getClusterDBNodes(self, clustername) if len(nodelist) < 1: - if LUCI_DEBUG_MODE is True: - luci_log.debug_verbose('GCSDB0a: removing cluster %s because it has no nodes' % clustername) + luci_log.info('Removing cluster %s because it has no nodes' \ + % clustername) try: clusters_dir = self.restrictedTraverse(CLUSTER_FOLDER_PATH) clusters_dir.manage_delObjects([clustername])
@@ -960,7 +962,7 @@ for node in nodelist: node_val = {} node_val['type'] = 'node' - node_val['name'] = node + node_val['name'] = node[0] node_val['clustered'] = '[unknown]' node_val['online'] = '[unknown]' node_val['error'] = True
luci/site/luci/Extensions/PropsObject.py +2 -2
@@ -7,7 +7,7 @@ from Variable import parse_variable from ricci_defines import PROPS_TAG -from xml.dom.Node import ELEMENT_NODE +import xml.dom class PropsObject:
@@ -35,7 +35,7 @@ def import_xml(self, parent_node): props = None for node in parent_node.childNodes: - if node.nodeType == ELEMENT_NODE: + if node.nodeType == xml.dom.Node.ELEMENT_NODE: if node.nodeName == PROPS_TAG: props = node if props is None:
luci/site/luci/Extensions/RicciQueries.py +5 -0
@@ -289,6 +289,9 @@ batch_str = '<module name="cluster"><request API_version="1.0"><function_call name="status"/></request></module>' ricci_xml = rc.batch_run(batch_str, async=False) + if not ricci_xml: + return None + try: cluster_tags = ricci_xml.getElementsByTagName('cluster') except Exception, e:
@@ -300,10 +303,12 @@ if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('GCSB1: %d entries - expecting 1' \ % len(cluster_tags)) + return None elif len(cluster_tags) > 1: if LUCI_DEBUG_MODE is True: luci_log.debug_verbose('GCSB2: %d entries, expecting 1 use first' \ % len(cluster_tags)) + try: cluster_node = cluster_tags[0] if not cluster_node:
luci/site/luci/Extensions/cluster_adapters.py +56 -100
328 lines not on this page · raw message
luci/site/luci/Extensions/ricci_communicator.py +8 -9
@@ -5,8 +5,7 @@ # GNU General Public License as published by the # Free Software Foundation. -from xml.dom import minidom -from xml.dom.Node import ELEMENT_NODE +from xml.dom import minidom, Node from conga_ssl import SSLSocket from LuciSyslog import get_logger from conga_constants import LUCI_DEBUG_MODE, LUCI_DEBUG_NET
@@ -242,7 +241,7 @@ batch_node = None for node in doc.firstChild.childNodes: - if node.nodeType == ELEMENT_NODE: + if node.nodeType == Node.ELEMENT_NODE: if node.nodeName == 'batch': batch_node = node#.cloneNode(True) if batch_node is None:
@@ -361,7 +360,7 @@ batch_node = None for node in doc.firstChild.childNodes: - if node.nodeType == ELEMENT_NODE: + if node.nodeType == Node.ELEMENT_NODE: if node.nodeName == 'batch': batch_node = node#.cloneNode(True) if batch_node is None:
@@ -500,7 +499,7 @@ total = 0 last = 0 for node in batch_xml.childNodes: - if node.nodeType == ELEMENT_NODE: + if node.nodeType == Node.ELEMENT_NODE: if node.nodeName == 'module': total = total + 1 status = node.getAttribute('status')
@@ -549,7 +548,7 @@ c = 0 for node in batch_xml.childNodes: - if node.nodeType == ELEMENT_NODE: + if node.nodeType == Node.ELEMENT_NODE: if node.nodeName == 'module': module_xml = node c = c + 1
@@ -558,17 +557,17 @@ if status == '0' or status == '4': # module executed, dig deeper into request for node_i in module_xml.childNodes: - if node_i.nodeType == ELEMENT_NODE: + if node_i.nodeType == Node.ELEMENT_NODE: if node_i.nodeName == 'API_error': return -2, 'API error' elif node_i.nodeName == 'response': for node_j in node_i.childNodes: - if node_j.nodeType == ELEMENT_NODE: + if node_j.nodeType == Node.ELEMENT_NODE: if node_j.nodeName == 'function_response': code = -11111111 msg = 'BUG' for var in node_j.childNodes: - if var.nodeType == ELEMENT_NODE: + if var.nodeType == Node.ELEMENT_NODE: if var.nodeName == 'var': if var.getAttribute('name') == 'success' and var.getAttribute('value') == 'true': return 0, ''