[Oval-commits] r291 - in trunk/oval-server: . oval/dba

Pavel Vinogradov blaze-guest at alioth.debian.org
Tue Oct 30 17:38:58 UTC 2007


Author: blaze-guest
Date: 2007-10-30 17:38:58 +0000 (Tue, 30 Oct 2007)
New Revision: 291

Modified:
   trunk/oval-server/OvalServer.BUGS
   trunk/oval-server/oval-server.py
   trunk/oval-server/oval/dba/dba.py
Log:
Fix UTC-zones in affected timestamps.

Modified: trunk/oval-server/OvalServer.BUGS
===================================================================
--- trunk/oval-server/OvalServer.BUGS	2007-10-30 17:37:20 UTC (rev 290)
+++ trunk/oval-server/OvalServer.BUGS	2007-10-30 17:38:58 UTC (rev 291)
@@ -1,7 +1,6 @@
 - CTRL+C don't kill server
   Server will stop only after client request. Because HttpThread
   locked in handle_response() and can't be terminated until release lock.
-- Fix UTC/Local time in timestamps
 - Uses the same user as the agent, should be different
 - Set the umask or log permissions properly. This is not correct:
   -rwxrwxr-x 1 root oval 1241 2007-09-05 00:42 oval-server.log

Modified: trunk/oval-server/oval/dba/dba.py
===================================================================
--- trunk/oval-server/oval/dba/dba.py	2007-10-30 17:37:20 UTC (rev 290)
+++ trunk/oval-server/oval/dba/dba.py	2007-10-30 17:38:58 UTC (rev 291)
@@ -78,13 +78,13 @@
 	def updateAffected(self, agentID, vulnID, status):
 		self.cursor.execute ('SELECT id FROM affected WHERE agentID = %d AND vulnDSA = %d' % 
 							(agentID, vulnID))
-		
+		timestamp = datetime.now().strftime('%Y-%m-%d %H:%M')	
 		try:
 			id = self.cursor.fetchall()[0][0]
-			self.cursor.execute ('UPDATE  affected set  status = %d, vulnTimestamp = CURRENT_TIMESTAMP WHERE id = %d' % (status, id))
+			self.cursor.execute ('UPDATE  affected set  status = %d, vulnTimestamp = \'%s\' WHERE id = %d' % (status, timestamp, id))
 		except IndexError:
-			self.cursor.execute ('INSERT INTO affected VALUES (NULL, %d, %d, CURRENT_TIMESTAMP, %d)' %
-								(agentID, vulnID, status))
+			self.cursor.execute ('INSERT INTO affected VALUES (NULL, %d, %d, \'%s\', %d)' %
+				(agentID, vulnID, timestamp, status))
 			
 	def updateDSA(self, dsa, location, timestamp):
 		self.cursor.execute ('SELECT vulnID FROM vulnerabilities WHERE vulnDSA = %d' % dsa)

Modified: trunk/oval-server/oval-server.py
===================================================================
--- trunk/oval-server/oval-server.py	2007-10-30 17:37:20 UTC (rev 290)
+++ trunk/oval-server/oval-server.py	2007-10-30 17:38:58 UTC (rev 291)
@@ -120,9 +120,8 @@
 		while self.__status:
 			try:
 				self.logger.debug('Run local sync')
-				syncStatus = self.syncer.sync()
-				
-				if syncStatus:
+
+				if self.syncer.sync():
 					self.logger.debug('Run agent sync')
 					for agent in self.db.getAgentsList():
 						self.logger.debug('Sync definitions for agent %s' % agent[1])




More information about the Oval-commits mailing list