# HG changeset patch
# User Vincent Hatakeyama <vincent.hatakeyama@xcg-consulting.fr>
# Date 1669718519 -3600
#      Tue Nov 29 11:41:59 2022 +0100
# Node ID 654c6823bfb4c17d52bf3c547f5eac9c4a98117e
# Parent  6add84c9da8a15e39a3fa240361fd0e5d8575298
👕 fix flake8 B023

diff --git a/odoo_scripts/docker_postgresql.py b/odoo_scripts/docker_postgresql.py
--- a/odoo_scripts/docker_postgresql.py
+++ b/odoo_scripts/docker_postgresql.py
@@ -79,10 +79,12 @@
             for mount_dict in container.attrs["Mounts"]:
                 if mount_dict["Destination"] == "/var/run/postgresql":
                     source = mount_dict["Source"]
-            return container, lambda: stop_postgresql(container), source
     volumes = {}
 
     volumes[pg_data_volume_name] = {
+                    break
+    if source:
+        return container, lambda: stop_postgresql(container), source
         "bind": "/var/lib/postgresql/data",
         "mode": "rw",
     }