From 20944b1dba6c8807e5f78e667553b77a06a30ff2 Mon Sep 17 00:00:00 2001 From: gmt2001 Date: Tue, 10 Dec 2024 02:44:10 -0500 Subject: [PATCH] Fix dependencies being restarted on dry-run or monitor-only --- pyouroboros/dockerclient.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pyouroboros/dockerclient.py b/pyouroboros/dockerclient.py index 67fe4dd..bf34bb2 100644 --- a/pyouroboros/dockerclient.py +++ b/pyouroboros/dockerclient.py @@ -320,7 +320,8 @@ def update(self): mylocals = {} mylocals['container'] = container run_hook('before_stop_depends_container', None, mylocals) - self.stop(container) + if not self.config.dry_run and not self.config.monitor_only: + self.stop(container) for container, current_image, latest_image in updateable: if self.config.dry_run: @@ -400,15 +401,19 @@ def update(self): mylocals = {} mylocals['container'] = container run_hook('before_start_depends_container', None, mylocals) - container.reload() - container.start() + if not self.config.dry_run and not self.config.monitor_only: + container.reload() + container.start() for container in hard_depends_on_containers: mylocals = {} mylocals['old_container'] = container run_hook('before_recreate_hard_depends_container', None, mylocals) - new_container = self.recreate(container, container.image) - mylocals['new_container'] = new_container + if not self.config.dry_run and not self.config.monitor_only: + new_container = self.recreate(container, container.image) + mylocals['new_container'] = new_container + else: + mylocals['new_container'] = container run_hook('after_recreate_hard_depends_container', None, mylocals) if updated_count > 0: