SEBA-298 Pass parser to callback in threadsafe way

Change-Id: Ia7f04eca63e83d9deaab5758c47d3889aef582cf
diff --git a/src/web_server/main.py b/src/web_server/main.py
index 9a6c9b3..271b1b2 100644
--- a/src/web_server/main.py
+++ b/src/web_server/main.py
@@ -39,12 +39,12 @@
 
     app = Klein()
 
-    def execute_tosca(self, recipe):
-        self.parser.execute()
-        if self.parser.delete:
-            response_text = "Deleted models: %s" % str(self.parser.ordered_models_name)
+    def execute_tosca(self, parser):
+        parser.execute()
+        if parser.delete:
+            response_text = "Deleted models: %s" % str(parser.ordered_models_name)
         else:
-            response_text = "Created models: %s" % str(self.parser.ordered_models_name)
+            response_text = "Created models: %s" % str(parser.ordered_models_name)
         return response_text
 
     def errorCallback(self, failure, request):
@@ -83,8 +83,8 @@
         username = headers['xos-username']
         password = headers['xos-password']
 
-        d = GRPC_Client().create_secure_client(username, password, recipe)
-        self.parser = TOSCA_Parser(recipe, username, password)
+        parser = TOSCA_Parser(recipe, username, password)
+        d = GRPC_Client().create_secure_client(username, password, parser)
         tosca_execution = d.addCallback(self.execute_tosca)
         tosca_execution.addErrback(self.errorCallback, request)
         return d
@@ -96,8 +96,8 @@
         username = headers['xos-username']
         password = headers['xos-password']
 
-        d = GRPC_Client().create_secure_client(username, password, recipe)
-        self.parser = TOSCA_Parser(recipe, username, password, delete=True)
+        parser = TOSCA_Parser(recipe, username, password, delete=True)
+        d = GRPC_Client().create_secure_client(username, password, parser)
         tosca_execution = d.addCallback(self.execute_tosca)
         tosca_execution.addErrback(self.errorCallback, request)
         return d