Skip to content

Commit

Permalink
FIXES #185: creates dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
muayyad-alsadi committed Dec 10, 2021
1 parent a3123ce commit 95e07e2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion podman_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,16 @@ def assert_volume(compose, mount_dict):
create volume if needed
"""
vol = mount_dict.get("_vol", None)
if mount_dict["type"] == "bind":
basedir = os.path.realpath(compose.dirname)
mount_src = mount_dict["source"]
mount_src = os.path.join(basedir, os.path.expanduser(mount_src))
if not os.path.exists(mount_src):
try:
os.makedirs(mount_src, exist_ok=True)
except OSError:
pass
return
if mount_dict["type"] != "volume" or not vol or vol.get("external", None) or not vol.get("name", None): return
proj_name = compose.project_name
vol_name = vol["name"]
Expand Down Expand Up @@ -1016,7 +1026,7 @@ def _parse_compose_file(self):
no_cleanup = args.no_cleanup
dry_run = args.dry_run
host_env = None
dirname = os.path.dirname(filename)
dirname = os.path.realpath(os.path.dirname(filename))
dir_basename = os.path.basename(dirname)
self.dirname = dirname
# TODO: remove next line
Expand Down

0 comments on commit 95e07e2

Please sign in to comment.