mirror of
https://github.com/containers/podman-compose.git
synced 2025-03-30 10:37:11 +02:00
FIXES #185: creates dirs
This commit is contained in:
parent
a3123ce480
commit
95e07e27f0
@ -278,6 +278,16 @@ def assert_volume(compose, mount_dict):
|
|||||||
create volume if needed
|
create volume if needed
|
||||||
"""
|
"""
|
||||||
vol = mount_dict.get("_vol", None)
|
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
|
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
|
proj_name = compose.project_name
|
||||||
vol_name = vol["name"]
|
vol_name = vol["name"]
|
||||||
@ -1016,7 +1026,7 @@ class PodmanCompose:
|
|||||||
no_cleanup = args.no_cleanup
|
no_cleanup = args.no_cleanup
|
||||||
dry_run = args.dry_run
|
dry_run = args.dry_run
|
||||||
host_env = None
|
host_env = None
|
||||||
dirname = os.path.dirname(filename)
|
dirname = os.path.realpath(os.path.dirname(filename))
|
||||||
dir_basename = os.path.basename(dirname)
|
dir_basename = os.path.basename(dirname)
|
||||||
self.dirname = dirname
|
self.dirname = dirname
|
||||||
# TODO: remove next line
|
# TODO: remove next line
|
||||||
|
Loading…
Reference in New Issue
Block a user