# HG changeset patch
# User Vincent Hatakeyama <vincent.hatakeyama@xcg-consulting.fr>
# Date 1669719902 -3600
#      Tue Nov 29 12:05:02 2022 +0100
# Node ID ce9c3e232984999cea2342e20d3d1c108e959487
# Parent  9ef54b2abded05a3880d6bd8ff9da56465727478
📝 create dict in one pass rather than two

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,15 +79,16 @@
             for mount_dict in container.attrs["Mounts"]:
                 if mount_dict["Destination"] == "/var/run/postgresql":
                     source = mount_dict["Source"]
-    volumes = {}
-
-    volumes[pg_data_volume_name] = {
                     break
     if source:
         return container, lambda: stop_postgresql(container), source
-        "bind": "/var/lib/postgresql/data",
-        "mode": "rw",
+    volumes = {
+        pg_data_volume_name: {
+            "bind": "/var/lib/postgresql/data",
+            "mode": "rw",
+        }
     }
+
     port_bindings = {}
     if host_pg_port:
         port_bindings[5432] = host_pg_port