]> git.pld-linux.org Git - projects/pld-builder.new.git/blobdiff - PLD_Builder/request_fetcher.py
Switch to https for client/request handler server and between builders communication...
[projects/pld-builder.new.git] / PLD_Builder / request_fetcher.py
index ce886e0df3635ae42722df289a59a2f7ade4a389..a677a71302fca94a2be12d85fa20a1464bff5534 100644 (file)
@@ -41,8 +41,9 @@ def has_new(control_url):
     signal.signal(signal.SIGALRM, alarmalarm)
     signal.alarm(300)
     try:
-        headers = urllib.urlencode( { 'Cache-Control': 'no-cache', 'Pragma': 'no-cache' } )
-        f = urllib2.urlopen(control_url + "/max_req_no", headers)
+        headers = { 'Cache-Control': 'no-cache', 'Pragma': 'no-cache' }
+        req = urllib2.Request(url=control_url + "/max_req_no", headers=headers)
+        f = urllib2.urlopen(req)
         count = int(string.strip(f.readline()))
         signal.alarm(0)
     except Exception, e:
@@ -60,8 +61,9 @@ def fetch_queue(control_url):
     socket.setdefaulttimeout(240)
     signal.alarm(300)
     try:
-        headers = urllib.urlencode( { 'Cache-Control': 'no-cache', 'Pragma': 'no-cache' } )
-        f = urllib2.urlopen(control_url + "/queue.gz", headers)
+        headers = { 'Cache-Control': 'no-cache', 'Pragma': 'no-cache' }
+        req = urllib2.Request(url=control_url + "/queue.gz", headers=headers)
+        f = urllib2.urlopen(req)
         signal.alarm(0)
     except Exception, e:
         signal.alarm(0)
@@ -90,7 +92,7 @@ def handle_reqs(builder, reqs):
     q.lock(0)
     q.read()
     for r in reqs:
-        if r.kind != 'group': 
+        if r.kind != 'group':
             raise Exception, 'handle_reqs: fatal: huh? %s' % r.kind
         need_it = 0
         for b in r.batches:
@@ -107,14 +109,15 @@ def main():
     if lck == None:
         sys.exit(1)
     init_conf()
-    
+    acl.try_reload()
+
     status.push("fetching requests")
     if has_new(config.control_url):
         q = fetch_queue(config.control_url)
         max_no = 0
         q_new = []
         for r in q:
-            if r.no > max_no: 
+            if r.no > max_no:
                 max_no = r.no
             if r.no > last_count:
                 q_new.append(r)
@@ -125,8 +128,8 @@ def main():
         f.close()
     status.pop()
     lck.close()
-    
+
 if __name__ == '__main__':
-    # http connection is established (and few bytes transferred through it) 
+    # http connection is established (and few bytes transferred through it)
     # each $secs seconds.
     loop.run_loop(main, secs = 10)
This page took 0.033672 seconds and 4 git commands to generate.