From 48e039994d4fe50c21485e37a70b98fe08368336 Mon Sep 17 00:00:00 2001
From: Thomas Kluyver <thomas@kluyver.me.uk>
Date: Thu, 23 Jun 2022 14:13:11 +0100
Subject: [PATCH] Add command to database after extending with parameters

---
 webservice/webservice.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/webservice/webservice.py b/webservice/webservice.py
index aabc47020..02f682daf 100644
--- a/webservice/webservice.py
+++ b/webservice/webservice.py
@@ -8,6 +8,7 @@ import json
 import locale
 import logging
 import os
+import shlex
 import sqlite3
 import sys
 import urllib.parse
@@ -1171,17 +1172,16 @@ class ActionsServer:
                 time_stamp=datetime.now().strftime('%y%m%d_%H%M%S'),
                 det_instance=karabo_id,
                 request_time=request_time
-            )
+            ).split()
+            cmd = parse_config(cmd, dconfig)
 
             with self.job_db:
                 cur = self.job_db.execute(
                     "INSERT INTO executions VALUES (NULL, ?, ?, ?, ?, NULL)",
-                    (req_id, cmd, detector, karabo_id)
+                    (req_id, shlex.join(cmd), detector, karabo_id)
                 )
                 exec_id = cur.lastrowid
 
-            cmd = cmd.split()
-            cmd = parse_config(cmd, dconfig)
             # TODO: Add detector info in returned run action status.
             ret.append(await run_action(
                 self.job_db, cmd, self.mode,
-- 
GitLab