From efda151cd5bd1ec26f32ff6fd7dcc878c61621a3 Mon Sep 17 00:00:00 2001 From: Peter Stockings Date: Mon, 18 Dec 2023 15:28:32 +1100 Subject: [PATCH] Update environment info for http_function after execution using the data returned from isolator --- app.py | 2 ++ db.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/app.py b/app.py index 8b18bb3..c5fc304 100644 --- a/app.py +++ b/app.py @@ -210,6 +210,8 @@ def execute_http_function(function): response = requests.post(API_URL, json={'code': code, 'request': request_obj, 'environment': environment}) response_data = response.json() + db.update_http_function_environment_info(function, json.dumps(response_data['environment'])) + # Map the Node.js response to Flask response flask_response = map_isolator_response_to_flask_response(response_data) return flask_response diff --git a/db.py b/db.py index ad57dce..fab026c 100644 --- a/db.py +++ b/db.py @@ -63,6 +63,10 @@ class DataBase(): def edit_http_function(self, name, script_content, environment_info): self.execute( 'UPDATE http_functions SET script_content=%s, environment_info=%s WHERE NAME=%s', [script_content, environment_info, name], commit=True) + + def update_http_function_environment_info(self, name, environment_info): + self.execute( + 'UPDATE http_functions SET environment_info=%s WHERE NAME=%s', [environment_info, name], commit=True) def delete_http_function(self, name): self.execute(