From mboxrd@z Thu Jan 1 00:00:00 1970 From: rmccabe@sourceware.org Date: 25 Oct 2006 01:53:35 -0000 Subject: [Cluster-devel] conga/luci cluster/form-macros site/luci/Exten ... Message-ID: <20061025015335.18358.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: conga Branch: RHEL5 Changes by: rmccabe at sourceware.org 2006-10-25 01:53:34 Modified files: luci/cluster : form-macros luci/site/luci/Extensions: cluster_adapters.py ricci_bridge.py Added files: luci/logs : Makefile index_html Log message: more fixes for bz# 211370 Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.90&r2=1.90.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/logs/Makefile.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=NONE&r2=1.1.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/logs/index_html.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=NONE&r2=1.1.2.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.120.2.5&r2=1.120.2.6 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_bridge.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.30.2.2&r2=1.30.2.3 --- conga/luci/cluster/form-macros 2006/10/16 20:34:37 1.90 +++ conga/luci/cluster/form-macros 2006/10/25 01:53:33 1.90.2.1 @@ -1716,7 +1716,7 @@

Recent Log Activity for


- +
/cvs/cluster/conga/luci/logs/Makefile,v --> standard output revision 1.1.2.1 --- conga/luci/logs/Makefile +++ - 2006-10-25 01:53:34.925377000 +0000 @@ -0,0 +1,19 @@ +LUCI_HOST=luci +LUCI_USER=admin +LUCI_PASS=changeme +LUCI_FTP=$(LUCI_HOST):8021 +LUCI_HTTP=http://$(LUCI_HOST):8080/luci + +all: + @true + +# import page local page templates to the Luci server +import: + @if test "$(FILES)"; then \ + ../load_site.py -u $(LUCI_USER):$(LUCI_PASS) $(LUCI_HTTP)/logs/ $(FILES) ; \ + else \ + find . -follow -maxdepth 1 -type f -not -name "Makefile*" -not -name ".*" -print0 | xargs -0 ../load_site.py -u $(LUCI_USER):$(LUCI_PASS) $(LUCI_HTTP)/logs/ ; \ + fi + +export: + @wget -q -r -nH --cut-dirs=2 "ftp://$(LUCI_USER):$(LUCI_PASS)@$(LUCI_FTP)/luci/logs/*" /cvs/cluster/conga/luci/logs/index_html,v --> standard output revision 1.1.2.1 --- conga/luci/logs/index_html +++ - 2006-10-25 01:53:35.014028000 +0000 @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + Get the global cache headers located in global_cache_settings. + + + + A slot where you can insert elements in the header from a template + + + + A slot where you can insert CSS in the header from a template + + + + + This is deprecated, please use style_slot instead. + + + + + A slot where you can insert javascript in the header from a template + + + + + + + + + +
+ +
+ + Log information for is being retrieved... + + +
+ +
+ +
+ + +
--- conga/luci/site/luci/Extensions/cluster_adapters.py 2006/10/24 16:36:23 1.120.2.5 +++ conga/luci/site/luci/Extensions/cluster_adapters.py 2006/10/25 01:53:34 1.120.2.6 @@ -2398,7 +2398,7 @@ states = getDaemonStates(rc, dlist) infohash['d_states'] = states - infohash['logurl'] = baseurl + "?pagetype=" + NODE_LOGS + "&nodename=" + nodename + "&clustername=" + clustername + infohash['logurl'] = '/luci/logs/?nodename=' + nodename + '&clustername=' + clustername return infohash #get list of faildoms for node @@ -2434,7 +2434,7 @@ map['status'] = NODE_INACTIVE map['status_str'] = NODE_INACTIVE_STR - map['logurl'] = baseurl + "?pagetype=" + NODE_LOGS + "&nodename=" + name + "&clustername=" + clustername + map['logurl'] = '/luci/logs?nodename=' + name + '&clustername=' + clustername #set up URLs for dropdown menu... if map['status'] == NODE_ACTIVE: map['jl_url'] = baseurl + "?pagetype=" + NODE_PROCESS + "&task=" + NODE_LEAVE_CLUSTER + "&nodename=" + name + "&clustername=" + clustername @@ -2594,27 +2594,43 @@ try: nodename = request.form['nodename'] except: - return "Unable to resolve node name %s to retrieve logging information" % nodename + luci_log.debug_verbose('Unable to get node name to retrieve logging information') + return 'Unable to get node name to retrieve logging information' + clustername = None try: clustername = request['clustername'] except KeyError, e: try: clustername = request.form['clusterName'] + if not clustername: + raise except: - return "Unable to resolve node name %s to retrieve logging information" % nodename - - try: - nodename_resolved = resolve_nodename(self, clustername, nodename) + clustername = None + luci_log.debug_verbose('Unable to find cluster name while retrieving logging information for %s' % nodename) except: - return "Unable to resolve node name %s to retrieve logging information" % nodename + pass + + if clustername is None: + nodename_resolved = nodename + else: + try: + nodename_resolved = resolve_nodename(self, clustername, nodename) + except: + luci_log.debug_verbose('Unable to resolve node name %s/%s to retrieve logging information' \ + % (nodename, clustername)) + return 'Unable to resolve node name for %s in cluster %s' % (nodename, clustername) try: rc = RicciCommunicator(nodename_resolved) - if not rc: - raise - except: - return "Unable to resolve node name %s to retrieve logging information" % nodename_resolved + except RicciError, e: + luci_log.debug_verbose('Ricci error while getting logs for %s: %s' \ + % (nodename_resolved, str(e))) + return 'Ricci error while getting logs for %s' % nodename_resolved + except: + luci_log.debug_verbose('Unexpected exception while getting logs for %s' \ + % nodename_resolved) + return 'Ricci error while getting logs for %s' % nodename_resolved if not rc.authed(): try: @@ -2622,7 +2638,15 @@ setNodeFlag(snode, CLUSTER_NODE_NEED_AUTH) except: pass - return "Luci is not authenticated to node %s. Please reauthenticate first." % nodename + + if clustername: + try: + cnode = getClusterNode(self, nodename, clustername) + setNodeFlag(cnode, CLUSTER_NODE_NEED_AUTH) + except: + pass + + return 'Luci is not authenticated to node %s. Please reauthenticate first.' % nodename return getNodeLogs(rc) --- conga/luci/site/luci/Extensions/ricci_bridge.py 2006/10/24 16:36:23 1.30.2.2 +++ conga/luci/site/luci/Extensions/ricci_bridge.py 2006/10/25 01:53:34 1.30.2.3 @@ -1,4 +1,5 @@ import xml +from time import time, ctime from xml.dom import minidom from ricci_communicator import RicciCommunicator @@ -284,10 +285,50 @@ batch_str = '' ricci_xml = rc.batch_run(batch_str, async=False) - doc = getPayload(ricci_xml) - if not doc or not doc.firstChild: + if not ricci_xml: return errstr - return doc.firstChild + try: + log_entries = ricci_xml.getElementsByTagName('logentry') + if not log_entries or len(log_entries) < 1: + raise Exception, 'no log data is available.' + except Exception, e: + 'Error retrieving log data from %s: %s' \ + % (rc.hostname(), str(e)) + return None + time_now = time() + entry = '' + for i in log_entries: + try: + log_msg = i.getAttribute('msg') + except: + log_msg = '' + + if not log_msg: + continue + + try: + log_age = int(i.getAttribute('age')) + except: + log_age = 0 + + try: + log_domain = i.getAttribute('domain') + except: + log_domain = '' + + try: + log_pid = i.getAttribute('pid') + except: + log_pid = '' + + if log_age: + entry += ctime(time_now - log_age) + ' ' + if log_domain: + entry += log_domain + if log_pid: + entry += '[' + log_pid + ']' + entry += ': ' + log_msg + '
' + return entry def nodeReboot(rc): batch_str = ''