From a6726f05677498c6d62da3dc45d484d61f43a828 Mon Sep 17 00:00:00 2001 From: Philipp Schmidt <philipp.schmidt@xfel.eu> Date: Tue, 14 Feb 2023 14:16:01 +0100 Subject: [PATCH] (fixup) Fix update_config test --- tests/test_update_config.py | 1 + webservice/update_config.py | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/tests/test_update_config.py b/tests/test_update_config.py index 7a4c79965..32588b239 100644 --- a/tests/test_update_config.py +++ b/tests/test_update_config.py @@ -70,6 +70,7 @@ def test_main(capsys): "--rel-gain", "true", "--webservice-address", "inproc://socket", "--correct", + "--verbose" ], ): with patch("zmq.Context", return_value=context): diff --git a/webservice/update_config.py b/webservice/update_config.py index 5143933c6..cef206fe5 100755 --- a/webservice/update_config.py +++ b/webservice/update_config.py @@ -95,6 +95,9 @@ action_group.add_argument( action_group.add_argument( '--dark', '-d', action='store_true') +parser.add_argument( + '--verbose', '-v', action='store_true', + help='More verbose output, i.a. print the entire configuration written.') parser.add_argument( '--apply', action='store_true', help='Apply and push the requested configuration update to the git.') @@ -276,13 +279,15 @@ def main(): resp = socket.recv_multipart()[0] print("# Configuration now in place is:") - total_config = yaml.safe_load(resp.decode()) - - print(yaml.dump({ - action: {instrument: { - karabo_id: total_config[action][instrument][karabo_id] - }} - }, default_flow_style=False)) + if args['verbose']: + print(resp.decode()) + else: + total_config = yaml.safe_load(resp.decode()) + print(yaml.dump({ + action: {instrument: { + karabo_id: total_config[action][instrument][karabo_id] + }} + }, default_flow_style=False)) if __name__ == '__main__': -- GitLab