[Cluster-devel] conga/luci cluster/form-macros site/luci/Exten ...
rmccabe at sourceware.org
rmccabe at sourceware.org
Thu Dec 14 18:22:56 UTC 2006
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-12-14 18:22:53
Modified files:
luci/cluster : form-macros
luci/site/luci/Extensions: cluster_adapters.py
Log message:
display as much information as possible when getting cluster from ricci info fails
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.130&r2=1.131
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.181&r2=1.182
--- conga/luci/cluster/form-macros 2006/12/13 23:54:19 1.130
+++ conga/luci/cluster/form-macros 2006/12/14 18:22:53 1.131
@@ -76,7 +76,7 @@
<tal:block tal:condition="python: ricci_agent">
<tal:block tal:define="
- global stat python: here.getClusterStatus(request, ricci_agent);
+ global stat python: here.getClusterStatus(request, ricci_agent, cluname=clu[0]);
global cstatus python: here.getClustersInfo(stat, request);
global cluster_status python: 'cluster ' + (('running' in cstatus and cstatus['running'] == 'true') and 'running' or 'stopped');"
/>
@@ -84,7 +84,7 @@
<table class="cluster" width="100%">
<tr class="cluster info_top">
<td class="cluster cluster_name">
- <strong class="cluster cluster_name">Cluster Name</strong>:
+ <strong class="cluster cluster_name">Cluster Name:</strong>
<a href=""
tal:attributes="href cstatus/clucfg | nothing;
class python: 'cluster ' + cluster_status;"
@@ -124,7 +124,7 @@
<tr class="cluster">
<td tal:condition="exists: cstatus/error" class="cluster">
<span class="errmsgs">
- An error occurred while attempting to get status information for this cluster. The information shown may be out of date.
+ An error occurred while attempting to get status information for this cluster. The information shown may be stale or inaccurate.
</span>
</td>
</tr>
--- conga/luci/site/luci/Extensions/cluster_adapters.py 2006/12/14 17:02:56 1.181
+++ conga/luci/site/luci/Extensions/cluster_adapters.py 2006/12/14 18:22:53 1.182
@@ -1862,32 +1862,42 @@
except:
try:
hostname = node[0]
- except:
+ except Exception, e:
+ luci_log.debug_verbose('GRA2a: %s' % str(e))
continue
try:
rc = RicciCommunicator(hostname)
- except RicciError, e:
+ if not rc:
+ raise Exception, 'rc is None'
+ ricci_hostname = rc.hostname()
+ if not ricci_hostname:
+ raise Exception, 'ricci_hostname is blank'
+ except Exception, e:
luci_log.debug('GRA3: ricci error: %s' % str(e))
continue
try:
clu_info = rc.cluster_info()
except Exception, e:
- luci_log.debug('GRA4: cluster_info error: %s' % str(e))
+ luci_log.debug('GRA4: cluster_info error for %s: %s' \
+ % (ricci_hostname, str(e)))
+ continue
try:
cur_name = str(clu_info[0]).strip().lower()
if not cur_name:
- raise
- except:
+ raise Exception, 'cluster name is none for %s' % ricci_hostname
+ except Exception, e:
+ luci_log.debug_verbose('GRA4a: %s' % str(e))
cur_name = None
try:
cur_alias = str(clu_info[1]).strip().lower()
if not cur_alias:
- raise
- except:
+ raise Exception, 'cluster alias is none'
+ except Exception, e:
+ luci_log.debug_verbose('GRA4b: %s' % str(e))
cur_alias = None
if (cur_name is not None and cluname != cur_name) and (cur_alias is not None and cluname != cur_alias):
@@ -1899,14 +1909,20 @@
pass
continue
- if rc.authed():
- return rc
try:
- setNodeFlag(node[1], CLUSTER_NODE_NEED_AUTH)
- except:
- pass
+ if rc.authed():
+ return rc
- luci_log.debug('GRA6: no ricci agent could be found for cluster %s' \
+ try:
+ setNodeFlag(node[1], CLUSTER_NODE_NEED_AUTH)
+ except:
+ pass
+ raise Exception, '%s not authed' % rc.hostname()
+ except Exception, e:
+ luci_log.debug_verbose('GRA6: %s' % str(e))
+ continue
+
+ luci_log.debug('GRA7: no ricci agent could be found for cluster %s' \
% cluname)
return None
@@ -1995,10 +2011,11 @@
results.append(vals)
try:
- cluster_path = '%s/luci/systems/cluster/%s' % (CLUSTER_FOLDER_PATH, clustername)
+ cluster_path = CLUSTER_FOLDER_PATH + clustername
nodelist = self.restrictedTraverse(cluster_path).objectItems('Folder')
except Exception, e:
- luci_log.debug_verbose('GCSDB0: %s: %s' % (clustername, str(e)))
+ luci_log.debug_verbose('GCSDB0: %s -> %s: %s' \
+ % (clustername, cluster_path, str(e)))
return results
for node in nodelist:
@@ -2014,7 +2031,7 @@
luci_log.debug_verbose('GCSDB1: %s' % str(e))
return results
-def getClusterStatus(self, request, rc):
+def getClusterStatus(self, request, rc, cluname=None):
try:
doc = getClusterStatusBatch(rc)
if not doc:
@@ -2036,14 +2053,15 @@
if not doc:
try:
- clustername = None
- try:
- clustername = request['clustername']
- except:
+ clustername = cluname
+ if clustername is None:
try:
- clustername = request.form['clustername']
+ clustername = request['clustername']
except:
- pass
+ try:
+ clustername = request.form['clustername']
+ except:
+ pass
if not clustername:
raise Exception, 'unable to determine cluster name'
@@ -2649,6 +2667,7 @@
svclist = list()
clulist = list()
baseurl = req['URL']
+
for item in status:
if item['type'] == "node":
nodelist.append(item)
@@ -2698,6 +2717,7 @@
svc_dict_list.append(svc_dict)
map['currentservices'] = svc_dict_list
node_dict_list = list()
+
for item in nodelist:
nmap = {}
name = item['name']
@@ -2713,7 +2733,6 @@
node_dict_list.append(nmap)
map['currentnodes'] = node_dict_list
-
return map
def nodeLeave(self, rc, clustername, nodename_resolved):
More information about the Cluster-devel
mailing list