Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions framework/python/src/core/testrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import signal
import sys
import time
import docker.errors

from common import logger, util, mqtt
from common.device import Device
from common.testreport import TestReport
Expand All @@ -32,8 +34,6 @@
from net_orc import network_orchestrator as net_orc
from test_orc import test_orchestrator as test_orc

from docker.errors import ImageNotFound

LOGGER = logger.get_logger('testrun')

DEFAULT_CONFIG_FILE = 'local/system.json'
Expand Down Expand Up @@ -516,7 +516,7 @@ def start_ui(self):
hostname='testrun.io',
detach=True,
ports={'80': 8080})
except ImageNotFound as ie:
except docker.errors.ImageNotFound as ie:
LOGGER.error('An error occured whilst starting the UI. ' +
'Please investigate and try again.')
LOGGER.error(ie)
Expand All @@ -532,6 +532,11 @@ def _stop_ui(self):
container = client.containers.get('tr-ui')
if container is not None:
container.kill()
# If the container has been started without auto-remove flag remove it
try:
container.remove()
except docker.errors.APIError:
pass
except docker.errors.NotFound:
pass

Expand All @@ -552,7 +557,7 @@ def start_ws(self):
'9001': 9001,
'1883': 1883
})
except ImageNotFound as ie:
except docker.errors.ImageNotFound as ie:
LOGGER.error('An error occured whilst starting the websockets server. ' +
'Please investigate and try again.')
LOGGER.error(ie)
Expand All @@ -565,5 +570,11 @@ def _stop_ws(self):
container = client.containers.get('tr-ws')
if container is not None:
container.kill()
# If the container has been started without auto-remove flag remove it
try:
container.remove()
except docker.errors.APIError:
pass

except docker.errors.NotFound:
pass