[Oval-commits] r152 - trunk/oval-server
Pavel Vinogradov
blaze-guest at alioth.debian.org
Mon Aug 20 03:37:46 UTC 2007
Author: blaze-guest
Date: 2007-08-20 03:37:45 +0000 (Mon, 20 Aug 2007)
New Revision: 152
Modified:
trunk/oval-server/oval-server.cfg
trunk/oval-server/oval-server.py
Log:
Implement httpThread
Modified: trunk/oval-server/oval-server.cfg
===================================================================
--- trunk/oval-server/oval-server.cfg 2007-08-19 18:37:22 UTC (rev 151)
+++ trunk/oval-server/oval-server.cfg 2007-08-20 03:37:45 UTC (rev 152)
@@ -1,9 +1,15 @@
-[server]
+[general]
log_dir = /tmp
log_file = oval-server.log
log_level = INFO
dsa_storage = /tmp/dsa
+[server]
+type = http
+ip = 127.0.0.1
+port = 8989
+workdir = /tmp/dsa
+
[agents]
agent_active = server, laptop
ip_server = 192.168.17.1
Modified: trunk/oval-server/oval-server.py
===================================================================
--- trunk/oval-server/oval-server.py 2007-08-19 18:37:22 UTC (rev 151)
+++ trunk/oval-server/oval-server.py 2007-08-20 03:37:45 UTC (rev 152)
@@ -2,6 +2,31 @@
import os, logging
import time
+class httpThread:
+ __status = None
+
+ def __init__ (self, config, logger):
+ self.type = config['type']
+ self.ip = config['ip']
+ self.port = int(config['port'])
+ self.workdir = config['workdir']
+
+ if self.type == 'http':
+ from OvalServer.OvalHttpServer import OvalHttpServer, HttpRequestHandler
+ self.server = OvalHttpServer ((self.ip, self.port), HttpRequestHandler)
+ self.logger = logger
+ self.logger.info('httpThread: Run local server on %s:%d in %s' % (self.ip, self.port, self.workdir))
+
+ def startThread (self):
+ self.__status = 1
+ self.run ()
+
+ def stopThread (self):
+ self.__status = None
+
+ def run (self):
+ self.server.serve_forever()
+
class syncThread:
__status = None
@@ -42,11 +67,11 @@
try:
# Read global server config
self.config.read(cfgfile)
- self.dsa_storage = self.config.get('server', 'dsa_storage')
+ self.dsa_storage = self.config.get('general', 'dsa_storage')
try:
- logdirname = self.config.get('server', 'log_dir')
- logfilename = self.config.get('server', 'log_file')
+ logdirname = self.config.get('general', 'log_dir')
+ logfilename = self.config.get('general', 'log_file')
self.outfilename = os.path.join(logdirname, logfilename)
except:
self.outfilename = os.path.join ('/tmp', 'oval-server.log')
@@ -81,11 +106,16 @@
def run(self):
self.logger.info('mainThread.RUN')
- #Create sync thread
- conf = self.readConfigSection('source')
- conf['dsa_storage'] = self.dsa_storage
- syncer = syncThread(conf, self.logger)
- syncer.startThread()
+# #Create sync thread
+# conf = self.readConfigSection('source')
+# conf['dsa_storage'] = self.dsa_storage
+# syncer = syncThread(conf, self.logger)
+# syncer.startThread()
+#
+ #Create http thread
+ conf = self.readConfigSection('server')
+ server = httpThread(conf, self.logger)
+ server.startThread()
self.logger.info('Shutting down')
logging.shutdown()
More information about the Oval-commits
mailing list