All of lore.kernel.org
 help / color / mirror / Atom feed
From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci/site/luci/Extensions conga_constant ...
Date: 8 Jun 2007 18:26:16 -0000	[thread overview]
Message-ID: <20070608182616.28562.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	EXPERIMENTAL
Changes by:	rmccabe at sourceware.org	2007-06-08 18:26:15

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

Log message:
	Groundwork and part of the fix for 227852

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_constants.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.39.2.8&r2=1.39.2.9
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_communicator.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.25.2.6&r2=1.25.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciSyslog.py.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.11.4.3&r2=1.11.4.4

--- conga/luci/site/luci/Extensions/conga_constants.py	2007/06/07 06:41:05	1.39.2.8
+++ conga/luci/site/luci/Extensions/conga_constants.py	2007/06/08 18:26:14	1.39.2.9
@@ -147,4 +147,5 @@
 # to >= 2 to get full debugging output in syslog (LOG_DAEMON/LOG_DEBUG).
 
 LUCI_DEBUG_MODE			= False
+LUCI_DEBUG_NET			= False
 LUCI_DEBUG_VERBOSITY	= 0
--- conga/luci/site/luci/Extensions/ricci_communicator.py	2007/06/01 23:18:16	1.25.2.6
+++ conga/luci/site/luci/Extensions/ricci_communicator.py	2007/06/08 18:26:15	1.25.2.7
@@ -10,7 +10,7 @@
 from xml.dom import minidom
 from LuciSyslog import get_logger
 from conga_ssl import SSLSocket
-from conga_constants import LUCI_DEBUG_MODE
+from conga_constants import LUCI_DEBUG_MODE, LUCI_DEBUG_NET
 
 CERTS_DIR_PATH = '/var/lib/luci/var/certs/'
 luci_log = get_logger()
@@ -37,22 +37,23 @@
 								self.__timeout_init)
 			if enforce_trust:
 				if not self.ss.trusted():
+					luci_log.info('The SSL certificate for host "%s" is not trusted. Aborting connection attempt.' % self.__hostname)
 					raise RicciError, 'ricci\'s certificate is not trusted'
 		except Exception, e:
-			raise RicciError, 'Error setting up SSL for connection to %s: %s' \
-				% (self.__hostname, str(e))
-		except:
-			raise RicciError, 'Error setting up SSL for connection to %s' \
-				% self.__hostname
+			errmsg = 'Unable to establish an SSL connection to %s:%d: %s' \
+						% ((self.__hostname, self.__port, str(e)))
+			luci_log.info(errmsg)
+			raise RicciError, errmsg
 
 		# receive ricci header
 		hello = self.__receive(self.__timeout_init)
 		try:
-			if LUCI_DEBUG_MODE is True:
-				luci_log.debug_verbose('RC:init0: recv header from %s: \"%s\"' \
+			if LUCI_DEBUG_NET is True:
+				luci_log.debug_net('RC:init0: recv header from %s: \"%s\"' \
 					% (self.__hostname, hello.toxml()))
 		except:
-			pass
+			if LUCI_DEBUG_MODE is True:
+				luci_log.debug_verbose('RC:init0: error receiving header from %s: %r %s' % (self.__hostname, e, str(e)))
 
 		self.__authed = hello.firstChild.getAttribute('authenticated') == 'true'
 		self.__cluname = hello.firstChild.getAttribute('clustername')
@@ -62,43 +63,47 @@
 		self.__dom0 = hello.firstChild.getAttribute('xen_host') == 'true'
 
 	def hostname(self):
-		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('RC:hostname: [auth %d] hostname = %s' \
+		if LUCI_DEBUG_NET is True:
+			luci_log.debug_net('RC:hostname: [auth %d] hostname = %s' \
 				% (self.__authed, self.__hostname))
 		return self.__hostname
 
 	def authed(self):
-		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('RC:authed: reported authed = %d for %s' \
+		if LUCI_DEBUG_NET is True:
+			luci_log.debug_net('RC:authed: reported authed = %d for %s' \
 				% (self.__authed, self.__hostname))
 		return self.__authed
 
 	def system_name(self):
-		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('RC:system_name: [auth %d] system_name = %s for %s' % (self.__authed, self.__reported_hostname, self.__hostname))
+		if LUCI_DEBUG_NET is True:
+			luci_log.debug_net('RC:SN: [auth %d] system_name = %s for %s' \
+				% (self.__authed, self.__reported_hostname, self.__hostname))
 		return self.__reported_hostname
 
 	def cluster_info(self):
-		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('RC:cluster_info: [auth %d] reported cluster_info = (%s,%s) for %s' % (self.__authed, self.__cluname, self.__clualias, self.__hostname))
+		if LUCI_DEBUG_NET is True:
+			luci_log.debug_net('RC:CI: [auth %d] (%s,%s) for %s' \
+				% (	self.__authed, self.__cluname,
+					self.__clualias, self.__hostname))
+
 		return (self.__cluname, self.__clualias)
 
 	def os(self):
-		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('RC:os: [auth %d] reported os = %s for %s' \
+		if LUCI_DEBUG_NET is True:
+			luci_log.debug_net('RC:OS: [auth %d] reported os = %s for %s' \
 				% (self.__authed, self.__os, self.__hostname))
 		return self.__os
 
 	def dom0(self):
-		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('RC:dom0: [auth %d] dom0 = %s for %s' \
+		if LUCI_DEBUG_NET is True:
+			luci_log.debug_net('RC:DOM0: [auth %d] dom0 = %s for %s' \
 				% (self.__authed, self.__dom0, self.__hostname))
 		return self.__dom0
 
 	def fingerprint(self):
 		fp = self.ss.peer_fingerprint()
-		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('RC:fp: [auth %d] fp for %s = %s' \
+		if LUCI_DEBUG_NET is True:
+			luci_log.debug_net('RC:fp: [auth %d] fp for %s = %s' \
 				% (self.__authed, self.__hostname, fp))
 		return fp
 
@@ -114,7 +119,7 @@
 	def auth(self, password):
 		if self.authed():
 			if LUCI_DEBUG_MODE is True:
-				luci_log.debug_verbose('RC:auth0: already authenticated to %s' \
+				luci_log.debug_verbose('RC:AUTH0: already authenticated to %s' \
 					% self.__hostname)
 			return True
 
@@ -138,11 +143,13 @@
 				self.__reported_hostname = resp.firstChild.getAttribute('hostname')
 				self.__os = resp.firstChild.getAttribute('os')
 				self.__dom0 = resp.firstChild.getAttribute('xen_host') == 'true'
-			except:
-				pass
+			except Exception, e:
+				if LUCI_DEBUG_MODE is True:
+					luci_log.debug_verbose('RC:AUTH1: %r %s for %s' \
+						% (e, str(e), self.__hostname))
 
-		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('RC:auth1: auth call returning %d' \
+		if LUCI_DEBUG_NET is True:
+			luci_log.debug_net('RC:auth1: auth call returning %d' \
 				% self.__authed)
 		return self.__authed
 
@@ -155,14 +162,10 @@
 		self.__send(doc, self.__timeout_auth)
 		resp = self.__receive(self.__timeout_auth)
 
-		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('RC:unauth0: unauthenticate %s' \
-				% self.__hostname)
-
 		try:
 			ret = resp.firstChild.getAttribute('success')
-			if LUCI_DEBUG_MODE is True:
-				luci_log.debug_verbose('RC:unauth1: unauthenticate %s for %s' \
+			if LUCI_DEBUG_NET is True:
+				luci_log.debug_net('RC:UNAUTH0: unauthenticate %s for %s' \
 					% (ret, self.__hostname))
 			if ret != '0':
 				raise Exception, 'Invalid response'
@@ -172,36 +175,36 @@
 			except:
 				pass
 		except:
-			errstr = 'Error authenticating to host %s: %s' \
+			errstr = 'Error authenticating host %s: %s' \
 						% (self.__hostname, str(ret))
-
-			if LUCI_DEBUG_MODE is True:
-				luci_log.debug_verbose('RC:unauth2: %s' % errstr)
+			luci_log.info(errstr)
 			raise RicciError, errstr
 		return True
 
-
 	def process_batch(self, batch_xml, async=False):
-		if LUCI_DEBUG_MODE is True:
-			try:
-				luci_log.debug_verbose('RC:PB0: [auth=%d] to %s for batch %s [async=%d]' % (self.__authed, self.__hostname, batch_xml.toxml(), async))
-			except:
-				pass
+		try:
+			if LUCI_DEBUG_NET is True:
+				luci_log.debug_net_priv('RC:PB0: [auth=%d] to %s for batch %s [async=%d]' % (self.__authed, self.__hostname, batch_xml.toxml(), async))
+		except:
+			pass
 
 		if not self.authed():
+			if LUCI_DEBUG_MODE is True:
+				luci_log.debug_verbose('RC:PB1: not authenticated to %s' \
+					% self.__hostname)
 			raise RicciError, 'not authenticated to host %s' % self.__hostname
 
 		# construct request
 		doc = minidom.Document()
-		ricci = doc.createElement("ricci")
-		ricci.setAttribute("version", "1.0")
-		ricci.setAttribute("function", "process_batch")
+		ricci = doc.createElement('ricci')
+		ricci.setAttribute('version', '1.0')
+		ricci.setAttribute('function', 'process_batch')
 		async_str = None
 		if async:
 			async_str = 'true'
 		else:
 			async_str = 'false'
-		ricci.setAttribute("async", async_str)
+		ricci.setAttribute('async', async_str)
 		doc.appendChild(ricci)
 		ricci.appendChild(batch_xml)#.cloneNode(True))
 
@@ -209,25 +212,25 @@
 		try:
 			self.__send(doc, self.__timeout_short)
 		except Exception, e:
-			if LUCI_DEBUG_MODE is True:
-				luci_log.debug_verbose('RC:PB1: Error sending XML \"%s\" to host %s' % (doc.toxml(), self.__hostname))
-			raise RicciError, 'Error sending XML to host %s: %s' \
-					% (self.__hostname, str(e))
-		except:
-			raise RicciError, 'Error sending XML to host %s' % self.__hostname
+			errstr = 'Error sending XML batch command to %s:%d: %s' \
+						% (self.__hostname, self.__port, str(e))
+			luci_log.info(errstr)
+			if LUCI_DEBUG_NET is True:
+				luci_log.debug_net_priv('RC:PB2: Error sending XML \"%s\" to host %s' % (doc.toxml(), self.__hostname))
+			raise RicciError, errstr
 
 		# receive response
 		doc = self.__receive(self.__timeout_long)
-		if LUCI_DEBUG_MODE is True:
+		if LUCI_DEBUG_NET is True:
 			try:
-				luci_log.debug_verbose('RC:PB2: received from %s XML \"%s\"' \
+				luci_log.debug_net_priv('RC:PB3: received from %s XML \"%s\"' \
 					% (self.__hostname, doc.toxml()))
 			except:
 				pass
 
 		if doc.firstChild.getAttribute('success') != '0':
 			if LUCI_DEBUG_MODE is True:
-				luci_log.debug_verbose('RC:PB3: batch command failed')
+				luci_log.debug_verbose('RC:PB4: batch command failed')
 			raise RicciError, 'The last ricci command to host %s failed' \
 					% self.__hostname
 
@@ -238,7 +241,8 @@
 					batch_node = node#.cloneNode(True)
 		if batch_node is None:
 			if LUCI_DEBUG_MODE is True:
-				luci_log.debug_verbose('RC:PB4: batch node missing <batch/>')
+				luci_log.debug_verbose('RC:PB5: no <batch/> from %s' \
+					% self.__hostname)
 			raise RicciError, 'missing <batch/> in ricci response from "%s"' \
 					% self.__hostname
 
@@ -248,24 +252,24 @@
 		try:
 			batch_xml_str = '<?xml version="1.0" ?><batch>%s</batch>' \
 				% batch_str
-			if LUCI_DEBUG_MODE is True:
-				luci_log.debug_verbose('RC:BRun0: attempting batch "%s" for host "%s"' % (batch_xml_str, self.__hostname))
+			if LUCI_DEBUG_NET is True:
+				luci_log.debug_net_priv('RC:BRun0: attempting batch "%s" for host "%s"' % (batch_xml_str, self.__hostname))
 			batch_xml = minidom.parseString(batch_xml_str).firstChild
 		except Exception, e:
-			if LUCI_DEBUG_MODE is True:
-				luci_log.debug_verbose('RC:BRun1: received invalid batch XML for %s: "%s": "%s"' % (self.__hostname, batch_xml_str, str(e)))
+			if LUCI_DEBUG_NET is True:
+				luci_log.debug_net_priv('RC:BRun1: received invalid batch XML for %s: "%s": "%s"' % (self.__hostname, batch_xml_str, str(e)))
 			raise RicciError, 'batch XML is malformed'
 
 		try:
 			ricci_xml = self.process_batch(batch_xml, async)
-			if LUCI_DEBUG_MODE is True:
+			if LUCI_DEBUG_NET is True:
 				try:
-					luci_log.debug_verbose('RC:BRun2: received XML "%s" from host %s in response to batch command.' % (ricci_xml.toxml(), self.__hostname))
+					luci_log.debug_net_priv('RC:BRun2: received XML "%s" from host %s in response to batch command.' % (ricci_xml.toxml(), self.__hostname))
 				except:
 					pass
 		except:
-			if LUCI_DEBUG_MODE is True:
-				luci_log.debug_verbose('RC:BRun3: An error occurred while trying to process the batch job: "%s"' % batch_xml_str)
+			if LUCI_DEBUG_NET is True:
+				luci_log.debug_net_priv('RC:BRun3: An error occurred while trying to process the batch job: "%s"' % batch_xml_str)
 			return None
 
 		doc = minidom.Document()
@@ -273,8 +277,8 @@
 		return doc
 
 	def batch_report(self, batch_id):
-		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('RC:BRep0: [auth=%d] asking for batchid# %s for host %s' % (self.__authed, batch_id, self.__hostname))
+		if LUCI_DEBUG_NET is True:
+			luci_log.debug_net('RC:BRep0: [auth=%d] asking for batchid# %s for host %s' % (self.__authed, batch_id, self.__hostname))
 
 		if not self.authed():
 			raise RicciError, 'Not authenticated to host %s' % self.__hostname
@@ -290,7 +294,6 @@
 		# send request
 		self.__send(doc, self.__timeout_short)
 
-
 		# receive response
 		doc = self.__receive(self.__timeout_short)
 		if doc.firstChild.getAttribute('success') == '12':
@@ -308,62 +311,63 @@
 
 
 	def __send(self, xml_doc, timeout):
-		buff = '%s\n' % xml_doc.toxml()
 		try:
-			self.ss.send(buff, timeout)
+			self.ss.send(xml_doc.toxml(), timeout)
+			self.ss.send('\n', timeout)
 		except Exception, e:
-			if LUCI_DEBUG_MODE is True:
-				luci_log.debug_verbose('RC:send0: Error sending XML "%s" to %s: %s' % (buff, self.__hostname, str(e)))
-			raise RicciError, 'write error while sending XML to host %s' \
-					% self.__hostname
-		except:
-			raise RicciError, 'write error while sending XML to host %s' \
+			if LUCI_DEBUG_NET is True:
+				luci_log.debug_net_priv('RC:send0: sending XML "%s" to %s: %s' \
+					% (xml_doc.toxml(), self.__hostname, str(e)))
+			luci_log.info('Error sending batch command to %s:%d: %s' \
+				% (self.__hostname, self.__port, str(e)))
+			raise RicciError, 'Write error while sending XML to host %s' \
 					% self.__hostname
-		if LUCI_DEBUG_MODE is True:
+
+		if LUCI_DEBUG_NET is True:
 			try:
-				luci_log.debug_verbose('RC:send1: Sent XML "%s" to host %s' \
+				luci_log.debug_net_priv('RC:send1: Sent XML "%s" to host %s' \
 					% (xml_doc.toxml(), self.__hostname))
 			except:
 				pass
 		return
 
 	def __receive(self, timeout):
-		doc = None
 		xml_in = ''
 		try:
 			xml_in = self.ss.recv(timeout)
 		except Exception, e:
-			if LUCI_DEBUG_MODE is True:
-				luci_log.debug_verbose('RC:recv0: Error reading from %s: %s' \
-					% (self.__hostname, str(e)))
-			raise RicciError, 'Error reading data from host %s' \
-				% self.__hostname
-		except:
-			raise RicciError, 'Error reading data from host %s' \
-				% self.__hostname
+			errstr = 'Error reading from %s:%d: %s' \
+						% (self.__hostname, self.__port, str(e))
+			luci_log.info(errstr)
+			raise RicciError, errstr
 
-		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('RC:recv1: Received XML "%s" from host %s' \
+		if LUCI_DEBUG_NET is True:
+			luci_log.debug_net_priv('RC:recv1: Received XML "%s" from host %s' \
 				% (xml_in, self.__hostname))
 
+		doc = None
 		try:
-			if doc is None:
-				doc = minidom.parseString(xml_in)
+			doc = minidom.parseString(xml_in)
 		except Exception, e:
-			if LUCI_DEBUG_MODE is True:
-				luci_log.debug_verbose('RC:recv2: parsing XML "%s" from %s' \
+			errstr = 'Error parsing XML from host %s:%d: %s' \
+						% (self.__hostname, self.__port, str(e))
+			luci_log.info(errstr)
+			if LUCI_DEBUG_NET is True:
+				luci_log.debug_net_priv('RC:recv2: parsing XML "%s" from %s' \
 					% (xml_in, str(e)))
-			raise RicciError, 'Error parsing XML from host %s: %s' \
-					% (self.__hostname, str(e))
+			raise RicciError, errstr
 
 		if not doc or not doc.firstChild:
+			if LUCI_DEBUG_MODE is True:
+				luci_log.debug_verbose('RC:recv3: empty XML response from %s' \
+					% self.__hostname)
 			raise RicciError, 'Error an empty response was received from host %s' % self.__hostname
 
 		try:
 			if doc.firstChild.nodeName != 'ricci':
-				if LUCI_DEBUG_MODE is True:
-					luci_log.debug_verbose('RC:recv3: Expecting "ricci" got XML "%s" from %s' % (xml_in, self.__hostname))
-				raise Exception, 'Expecting first XML child node to be "ricci"'
+				if LUCI_DEBUG_NET is True:
+					luci_log.debug_net_priv('RC:recv4: Expecting "<ricci>" tag, got XML "%s" from %s' % (xml_in, self.__hostname))
+				raise Exception, 'Expected first XML child node to be "<ricci>"'
 		except Exception, e:
 			raise RicciError, 'Invalid XML ricci response from host %s' \
 					% self.__hostname
@@ -374,10 +378,12 @@
 		return None
 
 	try:
-		return RicciCommunicator(hostname)
+		rc = RicciCommunicator(hostname)
+		if not rc:
+			raise Exception, 'initialization failed'
 	except Exception, e:
-		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('RC:GRC0: Error creating a ricci connection to %s: %s' % (hostname, str(e)))
+		luci_log.info('Error creating a ricci connection to %s: %r %s' \
+			% (hostname, e, str(e)))
 		return None
 
 def ricci_get_called_hostname(self, ricci):
@@ -413,9 +419,10 @@
 
 def batch_status(batch_xml):
 	if batch_xml.nodeName != 'batch':
-		if LUCI_DEBUG_MODE is True:
+		if LUCI_DEBUG_NET is True:
 			try:
-				luci_log.debug_verbose('RC:BS0: Expecting an XML batch node. Got \"%s\"' % batch_xml.toxml())
+				luci_log.debug_net_priv('RC:BS0: batch node. Got \"%s\"' \
+					% batch_xml.toxml())
 			except:
 				pass
 		raise RicciError, 'Not an XML batch node'
@@ -435,11 +442,12 @@
 					last = last + 1
 					last = last - 2 * last
 	try:
-		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('RC:BS1: Returning (%d, %d) for batch_status("%s")' % (last, total, batch_xml.toxml()))
+		if LUCI_DEBUG_NET is True:
+			luci_log.debug_net_priv('RC:BS1: (%d, %d) for batch_status("%s")' \
+				% (last, total, batch_xml.toxml()))
 	except Exception, e:
 		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('RC:BS2: error %r %s: (last, total)' \
+			luci_log.debug_verbose('RC:BS2: error %r %s: (%d, %d)' \
 				% (e, str(e), last, total))
 	return (last, total)
 
@@ -464,8 +472,8 @@
 
 def extract_module_status(batch_xml, module_num=1):
 	if batch_xml.nodeName != 'batch':
-		if LUCI_DEBUG_MODE is True:
-			luci_log.debug_verbose('RC:EMS0: Expecting "batch" got "%s"' \
+		if LUCI_DEBUG_NET is True:
+			luci_log.debug_net_priv('RC:EMS0: Expecting "batch" got "%s"' \
 				% batch_xml.toxml())
 		raise RicciError, 'Invalid XML node; expecting a batch node'
 
--- conga/luci/site/luci/Extensions/LuciSyslog.py	2007/05/18 02:36:59	1.11.4.3
+++ conga/luci/site/luci/Extensions/LuciSyslog.py	2007/06/08 18:26:15	1.11.4.4
@@ -32,37 +32,9 @@
 	def initialized(self):
 		return self.__init > 0
 
-	def info(self, msg):
-		if not self.__init:
-			return
-		try:
-			syslog(LOG_INFO, msg)
-		except:
-			#raise LuciSyslogError, 'syslog info call failed'
-			pass
-
-	def warn(self, msg):
-		if not self.__init:
-			return
-		try:
-			syslog(LOG_WARNING, msg)
-		except:
-			#raise LuciSyslogError, 'syslog warn call failed'
-			pass
-
-	def private(self, msg):
+	def log_msg(self, pri, msg):
 		if not self.__init:
 			return
-		try:
-			syslog(LOG_AUTH, msg)
-		except:
-			#raise LuciSyslogError, 'syslog private call failed'
-			pass
-
-	def debug_verbose(self, msg):
-		if not LUCI_DEBUG_MODE or LUCI_DEBUG_VERBOSITY < 2 or not self.__init:
-			return
-
 		msg_len = len(msg)
 		if msg_len < 1:
 			return
@@ -70,8 +42,9 @@
 		while True:
 			cur_len = min(msg_len, 800)
 			cur_msg = msg[:cur_len]
+
 			try:
-				syslog(LOG_DEBUG, cur_msg)
+				syslog(pri, cur_msg)
 			except:
 				pass
 
@@ -81,14 +54,34 @@
 			else:
 				break
 
+	def info(self, msg):
+		self.log_msg(LOG_INFO, msg)
+
+	def warn(self, msg):
+		self.log_msg(LOG_WARNING, msg)
+
+	def private(self, msg):
+		self.log_msg(LOG_AUTH, msg)
+
+	def debug_verbose(self, msg):
+		if LUCI_DEBUG_MODE is not True or LUCI_DEBUG_VERBOSITY < 2:
+			return
+		self.log_msg(LOG_DEBUG, msg)
+
+	def debug_net(self, msg):
+		if LUCI_DEBUG_MODE is not True or LUCI_DEBUG_VERBOSITY < 3:
+			return
+		self.log_msg(LOG_DEBUG, msg)
+
+	def debug_net_priv(self, msg):
+		if LUCI_DEBUG_MODE is not True or LUCI_DEBUG_VERBOSITY < 3:
+			return
+		self.log_msg(LOG_AUTH, msg)
+
 	def debug(self, msg):
-		if not LUCI_DEBUG_MODE or not self.__init:
+		if LUCI_DEBUG_MODE is not True:
 			return
-		try:
-			syslog(LOG_DEBUG, msg)
-		except:
-			#raise LuciSyslogError, 'syslog debug call failed'
-			pass
+		self.log_msg(LOG_DEBUG, msg)
 
 	def close(self):
 		try:



             reply	other threads:[~2007-06-08 18:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-08 18:26 rmccabe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-05-14 16:02 [Cluster-devel] conga/luci/site/luci/Extensions conga_constant rmccabe
2006-07-24 19:39 jparsons

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=20070608182616.28562.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.