diff --git a/src/ostorlab/runtimes/local/log_streamer.py b/src/ostorlab/runtimes/local/log_streamer.py index 1d0e43d0d..0fa64b9b7 100644 --- a/src/ostorlab/runtimes/local/log_streamer.py +++ b/src/ostorlab/runtimes/local/log_streamer.py @@ -40,7 +40,7 @@ class LogStream: def __init__(self): self._threads = [] self._color_map = {} - self.active_services = [] + self.services = [] def stream(self, service: docker.models.services.Service) -> None: """Stream logs of a service without blocking. @@ -52,7 +52,7 @@ def stream(self, service: docker.models.services.Service) -> None: """ color = self._select_color(service) logs = service.logs(details=False, follow=True, stdout=True, stderr=True) - self.active_services.append(service.id) + self.services.append(service.id) t = threading.Thread( target=_stream_log, args=(logs, service.name, color), daemon=True ) diff --git a/src/ostorlab/runtimes/local/runtime.py b/src/ostorlab/runtimes/local/runtime.py index d90806176..5c933941b 100644 --- a/src/ostorlab/runtimes/local/runtime.py +++ b/src/ostorlab/runtimes/local/runtime.py @@ -234,10 +234,10 @@ def scan( console.info("Updating scan status") self._update_scan_progress("IN_PROGRESS") console.success("Scan created successfully") - scan_complete_check = threading.Thread( + scan_complete_thread = threading.Thread( target=self._check_services_running, daemon=False ) - scan_complete_check.start() + scan_complete_thread.start() return self._scan_db except AgentNotHealthy: message = "Agent not starting" @@ -267,13 +267,13 @@ def _check_services_running(self) -> None: stop_event = threading.Event() while stop_event.is_set() is False: - for service_id in list(self._log_streamer.active_services): + for service_id in list(self._log_streamer.services): try: self._docker_client.services.get(service_id) except docker_errors.NotFound: - self._log_streamer.active_services.remove(service_id) - if len(self._log_streamer.active_services) == 0: - console.success("Scan completed.") + self._log_streamer.services.remove(service_id) + if len(self._log_streamer.services) == 0: + console.success("Scan done.") stop_event.set() sys.exit(0)