cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci cluster/form-macros site/luci/Exten ...
Date: 14 Dec 2006 18:22:56 -0000	[thread overview]
Message-ID: <20061214182256.23433.qmail@sourceware.org> (raw)

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):



             reply	other threads:[~2006-12-14 18:22 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-14 18:22 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-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:53 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=20061214182256.23433.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).