From 8837f11aec11ac84721f2d12481c3c0e93b68bd5 Mon Sep 17 00:00:00 2001
From: Andre Anjos <andre.dos.anjos@gmail.com>
Date: Mon, 9 May 2016 23:33:47 +0200
Subject: [PATCH] [backend] Fix Work cacallable setup

---
 beat/web/backend/views.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/beat/web/backend/views.py b/beat/web/backend/views.py
index 571ee4298..a7850f62c 100644
--- a/beat/web/backend/views.py
+++ b/beat/web/backend/views.py
@@ -65,13 +65,14 @@ class Work:
 
     def __setup__(self):
 
-        Worker.cpulimit = resolve_cpulimit_path(None)
-        Worker.process = utils.resolve_process_path()
-        Worker.environments = utils.find_environments(None)
-        Work.worker = Worker.objects.get(name=socket.gethostname()) \
+        Work.cpulimit = resolve_cpulimit_path(None)
+        Work.process = utils.resolve_process_path()
+        Work.environments = utils.find_environments(None)
+        w = Worker.objects.get(name=socket.gethostname()) \
             if Worker.objects.count() != 1 else Worker.objects.get()
-        Work.worker.activate()
-        Work.worker.save()
+        w.activate()
+        w.save()
+        Work.worker = w
 
     def __call__(self):
 
-- 
GitLab