From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci cluster/form-macros site/luci/Exten ...
Date: 25 Oct 2006 01:53:35 -0000 [thread overview]
Message-ID: <20061025015335.18358.qmail@sourceware.org> (raw)
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 @@
<div metal:define-macro="nodelogs-form">
<h2>Recent Log Activity for <span tal:replace="request/nodename"/></h2>
<hr/>
- <span tal:replace="python: here.getLogsForNode(request)"/>
+ <span tal:replace="structure python: here.getLogsForNode(request)"/>
</div>
<div metal:define-macro="nodeadd-form">
/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 @@
+<metal:page define-macro="master"><metal:doctype define-slot="doctype"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"></metal:doctype>
+<metal:block define-slot="top_slot" />
+<metal:block use-macro="here/global_defines/macros/defines" />
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xml:lang="en"
+ lang="en"
+ tal:attributes="lang language;
+ xml:lang language">
+
+ <head metal:use-macro="here/header/macros/html_header">
+
+ <metal:fillbase fill-slot="base">
+ <metal:baseslot define-slot="base">
+ <base href="" tal:attributes="href here/renderBase" />
+ </metal:baseslot>
+ </metal:fillbase>
+
+ <metal:headslot fill-slot="head_slot"
+ tal:define="lang language;
+ charset site_properties/default_charset|string:utf-8">
+
+ <metal:cache use-macro="here/global_cache_settings/macros/cacheheaders">
+ Get the global cache headers located in global_cache_settings.
+ </metal:cache>
+
+ <metal:headslot define-slot="head_slot" />
+ <tal:comment replace="nothing"> A slot where you can insert elements in the header from a template </tal:comment>
+ </metal:headslot>
+
+ <metal:styleslot fill-slot="style_slot">
+ <tal:comment replace="nothing"> A slot where you can insert CSS in the header from a template </tal:comment>
+ <metal:styleslot define-slot="style_slot" />
+ </metal:styleslot>
+
+ <metal:cssslot fill-slot="css_slot">
+ <tal:comment replace="nothing"> This is deprecated, please use style_slot instead. </tal:comment>
+ <metal:cssslot define-slot="css_slot" />
+ </metal:cssslot>
+
+ <metal:javascriptslot fill-slot="javascript_head_slot">
+ <tal:comment replace="nothing"> A slot where you can insert javascript in the header from a template </tal:comment>
+ <metal:javascriptslot define-slot="javascript_head_slot" />
+ </metal:javascriptslot>
+ </head>
+
+ <script type="text/javascript">
+ function delWaitBox() {
+ var waitbox = document.getElementById('waitbox');
+ if (!waitbox)
+ return (-1);
+ waitbox.parentNode.removeChild(waitbox);
+ return (0);
+ }
+ </script>
+
+ <body onLoad="javascript:delWaitBox()"
+ tal:attributes="class here/getSectionFromURL;
+ dir python:test(isRTL, 'rtl', 'ltr')">
+ <div id="visual-portal-wrapper">
+
+ <div id="portal-top" i18n:domain="plone">
+
+ <div id="portal-header">
+ <a metal:use-macro="here/global_logo/macros/portal_logo">
+ The portal logo, linked to the portal root
+ </a>
+ </div></div></div>
+
+ <div class="visualClear"><!-- --></div>
+
+ <div id="waitbox">
+ <span>
+ Log information for <span tal:replace="request/nodename | string: host"/> is being retrieved...
+ </span>
+ <img src="/luci/storage/100wait.gif">
+ </div>
+
+ <div id="log_data">
+ <span tal:replace="structure python: here.getLogsForNode(request)" />
+ </div>
+</body>
+</html>
+</metal:page>
--- 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 = '<module name="log"><request sequence="1254" API_version="1.0"><function_call name="get"><var mutable="false" name="age" type="int" value="18000"/><var mutable="false" name="tags" type="list_str"><listentry value="cluster"/></var></function_call></request></module>'
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 + '<br/>'
+ return entry
def nodeReboot(rc):
batch_str = '<module name="reboot"><request sequence="111" API_version="1.0"><function_call name="reboot_now"/></request></module>'
next reply other threads:[~2006-10-25 1:53 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-25 1:53 rmccabe [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-09-21 3:11 [Cluster-devel] conga/luci cluster/form-macros site/luci/Exten rmccabe
2007-06-19 15:54 rmccabe
2007-05-03 20:16 rmccabe
2007-03-15 16:41 rmccabe
2007-03-14 22:38 rmccabe
2007-03-14 22:37 rmccabe
2007-03-05 16:50 rmccabe
2007-03-05 16:50 rmccabe
2007-03-05 16:49 rmccabe
2007-02-15 22:44 rmccabe
2007-02-08 3:46 rmccabe
2007-02-07 17:02 rmccabe
2007-02-07 16:55 rmccabe
2007-02-02 4:34 rmccabe
2007-02-02 0:11 rmccabe
2007-02-01 20:49 rmccabe
2007-01-31 23:36 rmccabe
2007-01-31 5:26 rmccabe
2007-01-23 13:53 rmccabe
2007-01-15 18:21 rmccabe
2007-01-11 19:11 rmccabe
2007-01-10 21:40 rmccabe
2007-01-06 3:29 rmccabe
2006-12-14 23:14 rmccabe
2006-12-14 18:22 rmccabe
2006-12-11 22:42 rmccabe
2006-12-11 21:51 rmccabe
2006-12-06 22:11 rmccabe
2006-12-06 21:16 rmccabe
2006-11-13 21:40 rmccabe
2006-11-12 2:10 rmccabe
2006-11-09 20:32 rmccabe
2006-11-03 22:48 rmccabe
2006-10-25 1:11 rmccabe
2006-10-13 21:25 rmccabe
2006-08-03 18:36 shuennek
2006-07-21 14:49 rmccabe
2006-07-20 16:59 rmccabe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061025015335.18358.qmail@sourceware.org \
--to=rmccabe@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).