[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] conga/luci/site/luci/Extensions LuciSyslog.py ...



CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe sourceware org	2006-11-06 20:21:05

Modified files:
	luci/site/luci/Extensions: LuciSyslog.py cluster_adapters.py 

Log message:
	fix for the resource type check
	kill stale files (ricci_test.py, Quorumd.py)
	fixes for resolve_nodename

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciSyslog.py.diff?cvsroot=cluster&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.146&r2=1.147

--- conga/luci/site/luci/Extensions/LuciSyslog.py	2006/10/27 18:24:04	1.8
+++ conga/luci/site/luci/Extensions/LuciSyslog.py	2006/11/06 20:21:04	1.9
@@ -26,7 +26,8 @@
 		try:
 			syslog(LOG_INFO, msg)
 		except:
-			raise LuciSyslogError, 'syslog info call failed'
+			pass
+			#raise LuciSyslogError, 'syslog info call failed'
 
 	def warn(self, msg):
 		if not self.__init:
@@ -34,7 +35,8 @@
 		try:
 			syslog(LOG_WARNING, msg)
 		except:
-			raise LuciSyslogError, 'syslog warn call failed'
+			pass
+			#raise LuciSyslogError, 'syslog warn call failed'
 
 	def private(self, msg):
 		if not self.__init:
@@ -42,7 +44,8 @@
 		try:
 			syslog(LOG_AUTH, msg)
 		except:
-			raise LuciSyslogError, 'syslog private call failed'
+			pass
+			#raise LuciSyslogError, 'syslog private call failed'
 
 	def debug_verbose(self, msg):
 		if not LUCI_DEBUG_MODE or LUCI_DEBUG_VERBOSITY < 2 or not self.__init:
@@ -50,7 +53,8 @@
 		try:
 			syslog(LOG_DEBUG, msg)
 		except:
-			raise LuciSyslogError, 'syslog debug call failed'
+			pass
+			#raise LuciSyslogError, 'syslog debug call failed'
 
 	def debug(self, msg):
 		if not LUCI_DEBUG_MODE or not self.__init:
@@ -58,7 +62,8 @@
 		try:
 			syslog(LOG_DEBUG, msg)
 		except:
-			raise LuciSyslogError, 'syslog debug call failed'
+			pass
+			#raise LuciSyslogError, 'syslog debug call failed'
 
 	def close(self):
 		try:
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/11/06 17:30:49	1.146
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/11/06 20:21:04	1.147
@@ -469,7 +469,7 @@
 			raise Exception, 'An error occurred while adding this resource'
 		modelb = res[1]
 		newres = res[0]
-		addResource(self, request, modelb, newres)
+		addResource(self, request, modelb, newres, res_type)
 	except Exception, e:
 		if len(errors) < 1:
 			errors.append('An error occurred while adding this resource')
@@ -949,6 +949,13 @@
 
   return dummynode
 
+def getnodes(self, model):
+  mb = model
+  nodes = mb.getNodes()
+  names = list()
+  for node in nodes:
+    names.append(node.getName())
+  return names
 
 def createCluConfigTree(self, request, model):
   dummynode = {}
@@ -2232,9 +2239,6 @@
 			return None
 
 	nodename_resolved = resolve_nodename(self, clustername, nodename)
-	if not nodename_resolved or not nodename or not task or not clustername:
-		luci_log.debug('resolve_nodename failed for NTP')
-		return None
 
 	if task != NODE_FENCE:
 		# Fencing is the only task for which we don't
@@ -2662,11 +2666,7 @@
   #return infohash
   infohash['d_states'] = None
 
-  try:
-    nodename_resolved = resolve_nodename(self, clustername, nodename)
-  except:
-    luci_log.debug_verbose('Unable to resolve node name %s/%s to retrieve daemon information' % (nodename, clustername))
-    nodename_resolved = nodename
+  nodename_resolved = resolve_nodename(self, clustername, nodename)
 
   if nodestate == NODE_ACTIVE or nodestate == NODE_INACTIVE:
   #call service module on node and find out which daemons are running
@@ -2696,6 +2696,7 @@
   resultlist = list()
   nodelist = list()
   svclist = list()
+
   #Sort into lists...
   for item in status:
     if item['type'] == "node":
@@ -2705,13 +2706,36 @@
     else:
       continue
 
+  try:
+    clustername = req['clustername']
+    if not clustername:
+      raise KeyError, 'clustername is blank'
+  except:
+    try:
+      clustername = req.form['clustername']
+      raise KeyError, 'clustername is blank'
+    except:
+      try:
+        clustername = req.form['clusterName']
+      except:
+        try:
+          clustername = model.getClusterName()
+        except:
+          luci_log.debug_verbose('GNI0: unable to determine cluster name')
+          return {}
+      
+ 
   for item in nodelist:
     map = {}
     name = item['name']
     map['nodename'] = name
-    clustername = req['clustername']
-    baseurl = req['URL']
+    try:
+      baseurl = req['URL']
+    except:
+      baseurl = '/luci/cluster/index_html'
+
     cfgurl = baseurl + "?" + PAGETYPE + "=" + NODE + "&" + CLUNAME + "=" + clustername + "&nodename=" + name
+
     map['configurl'] = cfgurl
     map['fenceurl'] = cfgurl + "#fence"
     if item['clustered'] == "true":
@@ -2724,12 +2748,7 @@
       map['status'] = NODE_INACTIVE
       map['status_str'] = NODE_INACTIVE_STR
 
-    try:
-      nodename_resolved = resolve_nodename(self, clustername, name)
-    except:
-      luci_log.debug_verbose('Unable to resolve node name %s/%s' \
-          % (name, clustername))
-      nodename_resolved = name 
+    nodename_resolved = resolve_nodename(self, clustername, name)
 
     map['logurl'] = '/luci/logs?nodename=' + nodename_resolved + '&clustername=' + clustername
 
@@ -2957,12 +2976,7 @@
 	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)
+		nodename_resolved = resolve_nodename(self, clustername, nodename)
 
 	try:
 		rc = RicciCommunicator(nodename_resolved)
@@ -3092,7 +3106,7 @@
   try:
     items = clusterfolder.objectItems('ManagedSystem')
     if not items or len(items) < 1:
-      luci_log.debug_verbose('ICB3: no flags at %s for cluster %s' \
+      luci_log.debug_verbose('ICB3: NOT BUSY: no flags at %s for cluster %s' \
           % (cluname, path))
       return map  #This returns an empty map, and should indicate not busy
   except Exception, e:
@@ -4145,7 +4159,7 @@
 	
 	return messages
 
-def addResource(self, request, modelb, res):
+def addResource(self, request, modelb, res, type):
 	clustername = modelb.getClusterName()
 	if not clustername:
 		raise Exception, 'cluster name from modelb.getClusterName() is blank'
@@ -4190,7 +4204,7 @@
 		flag.manage_addProperty(BATCH_ID, batch_id, "string")
 		flag.manage_addProperty(TASKTYPE, RESOURCE_ADD, "string")
 
-		if res.attr_hash['type'] != 'ip':
+		if type != 'ip':
 			flag.manage_addProperty(FLAG_DESC, "Creating New Resource \'" + res.attr_hash['name'] + "\'", "string")
 		else:
 			flag.manage_addProperty(FLAG_DESC, "Creating New Resource \'" + res.attr_hash['address'] + "\'", "string")
@@ -4231,13 +4245,17 @@
 	except Exception, e:
 		luci_log.info('resolve_nodename failed for %s/%s: %s' \
 			% (nodename, clustername, str(e)))
+		return nodename
 
 	for obj in objs:
-		if obj[0].find(nodename) != (-1):
-			return obj[0]
+		try:
+			if obj[0].find(nodename) != (-1):
+				return obj[0]
+		except:
+			continue
 
 	luci_log.info('resolve_nodename failed for %s/%s' % (nodename, clustername))
-	return None
+	return nodename
 
 def noNodeFlagsPresent(self, nodefolder, flagname, hostname):
 	try:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]