diff --git a/webservice/webservice.py b/webservice/webservice.py index c01e3846264ea141d7b2fd429ab0cdbcfad5216f..f417bdf02c53553e89cbf6af60e3226b118ff9a5 100644 --- a/webservice/webservice.py +++ b/webservice/webservice.py @@ -8,7 +8,6 @@ import logging import os import sqlite3 import subprocess -import traceback import urllib.parse from datetime import datetime @@ -169,11 +168,8 @@ async def change_config(socket, config, updated_config, instrument, cycle, defconf = yaml.load(f.read(), Loader=yaml.FullLoader) subconf = {} for action, instruments in defconf.items(): - subconf[action] = {} - if action != "data-mapping": - subconf[action][instrument] = instruments[instrument] - else: - subconf[action][instrument] = instruments[karabo_id] + subconf[action]= {} + subconf[action][instrument] = instruments[instrument] with open(fpath, "w") as wf: wf.write(yaml.dump(subconf, default_flow_style=False)) new_conf = None @@ -575,16 +571,16 @@ async def server_runner(config, mode): if action in ['update_conf']: updated_config = None try: - sase, karabo_id, instrument, cycle, proposal, config_yaml, apply = payload # noqa + sase, instrument, cycle, proposal, config_yaml, apply = payload # noqa updated_config = json.loads(config_yaml) await change_config(socket, config['config-repo'], - updated_config, karab_id, instrument, - cycle, proposal, apply.upper()=="TRUE") + updated_config, instrument, cycle, + proposal, apply.upper()=="TRUE") except Exception as e: + e = str(e) err_msg = f"Failure applying config for {proposal}:" + \ - f" {str(e)}: {updated_config}" + f" {e}: {updated_config}" logging.error(err_msg) - logging.error(f"Unexpected error: {traceback.format_exc()}") socket.send(yaml.dump(err_msg, default_flow_style=False).encode()) if action in ['dark', 'correct']: