Skip to contentSkip to conversation

conga/luci/site/luci/Extensions LuciSyslog.py ...

Cluster-devel [email protected] 1 participant 1 message Oct 24, 2006

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: conga
Branch: RHEL5
Changes by: rmccabe at sourceware.org 2006-10-24 16:36:23

Modified files:
luci/site/luci/Extensions: LuciSyslog.py cluster_adapters.py
conga_constants.py homebase_adapters.py ricci_bridge.py ricci_communicator.py

Log message:
see bz# 211375

These patches add verbose logging that'll allow QE to better debug defects (in a lot of places, there was no useful output for them to check).

Two new global variables are introduced:

LUCI_DEBUG_MODE = 1
LUCI_DEBUG_VERBOSITY = 2

Both of these need to be set to 0 for GA. LUCI_DEBUG_VERBOSITY > 1 will cause ricci_xml input and output to be logged using using syslog LOG_DAEMON/LOG_DEBUG. syslogd is not configured to log this severity by default, so an entry along the lines of *.debug /var/log/debug should be added if this facility is used.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciSyslog.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.2&r2=1.2.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.4&r2=1.120.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_constants.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.19&r2=1.19.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/homebase_adapters.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.34&r2=1.34.2.1
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.1&r2=1.30.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_communicator.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.9&r2=1.9.2.1

luci/site/luci/Extensions/LuciSyslog.py +24 -2
@@ -1,3 +1,4 @@
+from conga_constants import LUCI_DEBUG_MODE, LUCI_DEBUG_VERBOSITY
 from syslog import openlog, closelog, syslog, \
 		LOG_DAEMON, LOG_PID, LOG_NDELAY, LOG_INFO, \
 		LOG_WARNING, LOG_AUTH, LOG_DEBUG
@@ -12,34 +13,55 @@
 """
 class LuciSyslog:
 	def __init__(self):
+		self.__init = 0
 		try:
-			openlog('luci', LOG_DAEMON, LOG_PID | LOG_NDELAY)
+			openlog('luci', LOG_PID | LOG_NDELAY, LOG_DAEMON)
+			self.__init = 1
 		except:
 			raise LuciSyslogError, 'unable to setup syslog functionality.'
 
 	def info(self, msg):
+		if not self.__init:
+			return
 		try:
 			syslog(LOG_INFO, msg)
 		except:
 			raise LuciSyslogError, 'syslog info call failed'
 
 	def warn(self, msg):
+		if not self.__init:
+			return
 		try:
 			syslog(LOG_WARNING, msg)
 		except:
 			raise LuciSyslogError, 'syslog warn call failed'
 
 	def private(self, msg):
+		if not self.__init:
+			return
 		try:
 			syslog(LOG_AUTH, msg)
 		except:
 			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:
+			return
+		try:
+			syslog(LOG_DEBUG, msg)
+		except:
+			raise LuciSyslogError, 'syslog debug calle failed'
+
 	def debug(self, msg):
+		if not LUCI_DEBUG_MODE or not self.__init:
+			return
 		try:
 			syslog(LOG_DEBUG, msg)
 		except:
 			raise LuciSyslogError, 'syslog debug calle failed'
 
 	def close(self):
-		closelog()
+		try:
+			closelog()
+		except:
+			pass
luci/site/luci/Extensions/cluster_adapters.py +375 -107

917 lines not on this page · raw message

luci/site/luci/Extensions/conga_constants.py +3 -0
@@ -113,3 +113,6 @@
 CLUSTER_NODE_ADDED = 0x04
 
 PLONE_ROOT='luci'
+
+LUCI_DEBUG_MODE = 1
+LUCI_DEBUG_VERBOSITY = 2
luci/site/luci/Extensions/homebase_adapters.py +2 -2
@@ -1367,7 +1367,7 @@
 		pass
 	return False
 
-def setNodeFlag(self, node, flag_mask):
+def setNodeFlag(node, flag_mask):
 	try:
 		flags = node.getProperty('flags')
 		node.manage_changeProperties({ 'flags': flags | flag_mask })
@@ -1377,7 +1377,7 @@
 		except:
 			pass
 
-def delNodeFlag(self, node, flag_mask):
+def delNodeFlag(node, flag_mask):
 	try:
 		flags = node.getProperty('flags')
 		if flags & flag_mask != 0:
luci/site/luci/Extensions/ricci_bridge.py +1 -1
@@ -298,7 +298,7 @@
 		return (None, None)
 	return batchAttemptResult(doc)
 
-def nodeLeaveCluster(rc, cluster_shutdown=False, purge=True):
+def nodeLeaveCluster(rc, cluster_shutdown=False, purge=False):
 	cshutdown = 'false'
 	if cluster_shutdown == True:
 		cshutdown = 'true'
luci/site/luci/Extensions/ricci_communicator.py +170 -45

371 lines not on this page · raw message