From e51fd376b3d7ee8aa714af97619d41427369f640 Mon Sep 17 00:00:00 2001 From: Jacob Boddey Date: Tue, 2 Jan 2024 14:30:01 +0000 Subject: [PATCH 1/2] Add check before launching UI --- framework/python/src/core/testrun.py | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/framework/python/src/core/testrun.py b/framework/python/src/core/testrun.py index 48e31c721..640ba971f 100644 --- a/framework/python/src/core/testrun.py +++ b/framework/python/src/core/testrun.py @@ -36,6 +36,8 @@ from net_orc import network_orchestrator as net_orc from test_orc import test_orchestrator as test_orc +from docker.errors import ImageNotFound + # Locate parent directory current_dir = os.path.dirname(os.path.realpath(__file__)) @@ -430,16 +432,22 @@ def start_ui(self): client = docker.from_env() - client.containers.run( - image='test-run/ui', - auto_remove=True, - name='tr-ui', - hostname='testrun.io', - detach=True, - ports={ - '80': 8080 - } - ) + try: + client.containers.run( + image='test-run/ui', + auto_remove=True, + name='tr-ui', + hostname='testrun.io', + detach=True, + ports={ + '80': 8080 + } + ) + except ImageNotFound as ie: + LOGGER.error('An error occured whilst starting the UI. ' + + 'Please investigate and try again.') + print(ie) + sys.exit(1) # TODO: Make port configurable LOGGER.info('User interface is ready on http://localhost:8080') From 4df87e61b49e815bc26b2b6b93fbe8bcecd5ecc0 Mon Sep 17 00:00:00 2001 From: Jacob Boddey Date: Tue, 2 Jan 2024 14:32:00 +0000 Subject: [PATCH 2/2] Switch print to LOGGER --- framework/python/src/core/testrun.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/python/src/core/testrun.py b/framework/python/src/core/testrun.py index 640ba971f..f579eba26 100644 --- a/framework/python/src/core/testrun.py +++ b/framework/python/src/core/testrun.py @@ -446,7 +446,7 @@ def start_ui(self): except ImageNotFound as ie: LOGGER.error('An error occured whilst starting the UI. ' + 'Please investigate and try again.') - print(ie) + LOGGER.error(ie) sys.exit(1) # TODO: Make port configurable