From f35c88cc1d95be64c547e8428c541caa091bdb94 Mon Sep 17 00:00:00 2001
From: Karim Ahmed <karim.ahmed@xfel.eu>
Date: Wed, 18 Sep 2019 10:52:27 +0200
Subject: [PATCH] add req arguments parser group

---
 webservice/update_config.py | 11 ++++++-----
 webservice/webservice.py    |  1 +
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/webservice/update_config.py b/webservice/update_config.py
index ff82db28e..77f6ffe25 100644
--- a/webservice/update_config.py
+++ b/webservice/update_config.py
@@ -15,14 +15,15 @@ available_options = {
 
 parser = argparse.ArgumentParser(
     description='Request update of configuration')
-parser.add_argument('--detector', type=str, choices=['AGIPD'])
-parser.add_argument('--task', type=str, choices=['correct', 'dark'])
-parser.add_argument('--proposal', type=str,
+required_args = parser.add_argument_group('required arguments')
+required_args.add_argument('--detector', type=str, choices=['AGIPD'])
+required_args.add_argument('--task', type=str, choices=['correct', 'dark'])
+required_args.add_argument('--proposal', type=str,
                     help='The proposal number, without leading p, but with leading zeros')  # noqa
-parser.add_argument('--instrument', type=str,
+required_args.add_argument('--instrument', type=str,
                     choices=["SPB", "MID", "FXE", "SCS", "SQS", "HED",
                              "DETLAB"], help='The instrument')  # noqa
-parser.add_argument('--cycle', type=str, help='The facility cycle')
+required_args.add_argument('--cycle', type=str, help='The facility cycle')
 parser.add_argument('--apply', action='store_true')
 
 # remove help calls as they will cause the argument parser to exit
diff --git a/webservice/webservice.py b/webservice/webservice.py
index 054b69f4f..76223ce41 100644
--- a/webservice/webservice.py
+++ b/webservice/webservice.py
@@ -455,6 +455,7 @@ async def server_runner(config, mode):
             req_res = None
 
             if action in ['update_conf']:
+                updated_config = None
                 try:
                     sase, instrument, cycle, proposal, config_yaml, apply = payload  # noqa
                     updated_config = json.loads(config_yaml)
-- 
GitLab