[Pkg-debile-commits] [debile-master] 07/126: server update

Sylvestre Ledru sylvestre at alioth.debian.org
Mon Aug 19 14:56:05 UTC 2013


This is an automated email from the git hooks/post-receive script.

sylvestre pushed a commit to branch scan-build-html
in repository debile-master.

commit f84489c85029aca5ff7a0f351f1997623db232fb
Author: Paul Tagliamonte <tag at pault.ag>
Date:   Tue May 21 15:58:38 2013 -0400

    server update
---
 lucy/server.py |   20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/lucy/server.py b/lucy/server.py
index 39f3ae3..f49623c 100644
--- a/lucy/server.py
+++ b/lucy/server.py
@@ -13,6 +13,10 @@ import threading
 NAMESPACE = threading.local()
 
 
+def get_builder_id():
+    return NAMESPACE.machine['_id']
+
+
 class LucyAuthMixIn(SimpleXMLRPCRequestHandler):
     def authenticate(self):
         (basic, _, encoded) = self.headers.get('Authorization').partition(' ')
@@ -45,10 +49,10 @@ class LucyInterface(object):
         return "1.0"
 
     def identify(self):
-        return NAMESPACE.machine['_id']
+        return get_builder_id()
 
     def get_next_job(self, job_type):
-        ajobs = list(Job.assigned_jobs(NAMESPACE.machine['_id']))
+        ajobs = list(Job.assigned_jobs(get_builder_id()))
         if ajobs != []:
             return dict(ajobs[0])
 
@@ -57,7 +61,7 @@ class LucyInterface(object):
         except KeyError:
             return None
 
-        job['builder'] = NAMESPACE.machine['_id']
+        job['builder'] = get_builder_id()
         job['assigned_at'] = dt.datetime.utcnow()
         job.save()
         return dict(job)
@@ -70,10 +74,10 @@ class LucyInterface(object):
         builder = job.get_builder()
         builder = builder['_id'] if builder else None
 
-        if builder != NAMESPACE.machine['_id']:
+        if builder != get_builder_id():
             raise ValueError("Machine isn't assigned.")
 
-        r = Report(builder=NAMESPACE.machine['_id'],
+        r = Report(builder=get_builder_id(),
                    job=job['_id'],
                    report=report,
                    package=job['package'])
@@ -84,6 +88,12 @@ class LucyInterface(object):
         if job.is_finished():
             raise ValueError("job is already closed")
 
+        builder = job.get_builder()
+        builder = builder['_id'] if builder else None
+
+        if builder != get_builder_id():
+            raise ValueError("Machine isn't assigned.")
+
         job['finished_at'] = dt.datetime.utcnow()
         return job.save()
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-debile/debile-master.git



More information about the Pkg-debile-commits mailing list