[Secure-testing-commits] r12985 - bin

Florian Weimer fw at alioth.debian.org
Sun Oct 11 12:04:23 UTC 2009


Author: fw
Date: 2009-10-11 12:04:15 +0000 (Sun, 11 Oct 2009)
New Revision: 12985

Modified:
   bin/tracker_service.py
Log:
bin/tracker_service.py: implement HTTP invocation

The old command line arguments still create a servinvoke-based service.


Modified: bin/tracker_service.py
===================================================================
--- bin/tracker_service.py	2009-10-11 12:02:02 UTC (rev 12984)
+++ bin/tracker_service.py	2009-10-11 12:04:15 UTC (rev 12985)
@@ -2,18 +2,27 @@
 
 import sys
 sys.path.insert(0,'../lib/python')
-
-if len(sys.argv) <> 3:
-    print "usage: python tracker_serivce.py SOCKET-PATH DATABASE-PATH"
-    sys.exit(1)
-socket_name = sys.argv[1]
-db_name = sys.argv[2]
-
 import bugs
 import re
 import security_db
 from web_support import *
 
+if len(sys.argv) not in (3, 5):
+    print "usage: python tracker_service.py SOCKET-PATH DATABASE-PATH"
+    print "       python tracker_service.py URL HOST PORT DATABASE-PATH"
+    sys.exit(1)
+if len(sys.argv) == 3:
+    socket_name = sys.argv[1]
+    db_name = sys.argv[2]
+    webservice_base_class = WebService
+else:
+    server_base_url = sys.argv[1]
+    server_address = sys.argv[2]
+    server_port = int(sys.argv[3])
+    socket_name = (server_base_url, server_address, server_port)
+    db_name = sys.argv[4]
+    webservice_base_class = WebServiceHTTP
+
 class BugFilter:
     default_action_list = [("hide_medium_urgency", "lower urgencies"),
                            ("hide_non_remote", "local vulnerabilities")]
@@ -62,7 +71,7 @@
         """Returns True if no DSA will be issued for the bug."""
         return nodsa and self.params['hide_nodsa']
 
-class TrackerService(WebService):
+class TrackerService(webservice_base_class):
     head_contents = compose(STYLE(
         """h1 { font-size : 144%; }
 h2 { font-size : 120%; }
@@ -94,7 +103,7 @@
 ''')).toHTML()
     
     def __init__(self, socket_name, db_name):
-        WebService.__init__(self, socket_name)
+        webservice_base_class.__init__(self, socket_name)
         self.db = security_db.DB(db_name)
         self.register('', self.page_home)
         self.register('*', self.page_object)




More information about the Secure-testing-commits mailing list