mirror of
https://github.com/containers/podman-compose.git
synced 2025-03-28 08:37:22 +01:00
FIXES #386: make sure volumes are present in top level
This commit is contained in:
parent
523d215b48
commit
154a51245f
@ -398,14 +398,20 @@ def mount_desc_to_volume_args(compose, mount_desc, srv_name, cnt_name):
|
|||||||
if opts: args += ':' + ','.join(opts)
|
if opts: args += ':' + ','.join(opts)
|
||||||
return args
|
return args
|
||||||
|
|
||||||
def get_mount_args(compose, cnt, volume):
|
def get_mnt_dict(compose, cnt, volume):
|
||||||
proj_name = compose.project_name
|
proj_name = compose.project_name
|
||||||
srv_name = cnt['_service']
|
srv_name = cnt['_service']
|
||||||
basedir = compose.dirname
|
basedir = compose.dirname
|
||||||
if is_str(volume): volume = parse_short_mount(volume, basedir)
|
if is_str(volume):
|
||||||
mount_type = volume["type"]
|
volume = parse_short_mount(volume, basedir)
|
||||||
|
return fix_mount_dict(compose, volume, proj_name, srv_name)
|
||||||
|
|
||||||
assert_volume(compose, fix_mount_dict(compose, volume, proj_name, srv_name))
|
def get_mount_args(compose, cnt, volume):
|
||||||
|
volume = get_mnt_dict(compose, cnt, volume)
|
||||||
|
proj_name = compose.project_name
|
||||||
|
srv_name = cnt['_service']
|
||||||
|
mount_type = volume["type"]
|
||||||
|
assert_volume(compose, volume)
|
||||||
if compose._prefer_volume_over_mount:
|
if compose._prefer_volume_over_mount:
|
||||||
if mount_type == 'tmpfs':
|
if mount_type == 'tmpfs':
|
||||||
# TODO: --tmpfs /tmp:rw,size=787448k,mode=1777
|
# TODO: --tmpfs /tmp:rw,size=787448k,mode=1777
|
||||||
@ -1230,6 +1236,12 @@ class PodmanCompose:
|
|||||||
cnt['_service'] = service_name
|
cnt['_service'] = service_name
|
||||||
cnt['_project'] = project_name
|
cnt['_project'] = project_name
|
||||||
given_containers.append(cnt)
|
given_containers.append(cnt)
|
||||||
|
volumes = cnt.get("volumes", None) or []
|
||||||
|
for volume in volumes:
|
||||||
|
mnt_dict = get_mnt_dict(self, cnt, volume)
|
||||||
|
if mnt_dict.get("type", None)=="volume" and mnt_dict["source"] and mnt_dict["source"] not in self.vols:
|
||||||
|
vol_name = mnt_dict["source"]
|
||||||
|
raise RuntimeError(f"volume [{vol_name}] not defined in top level")
|
||||||
self.container_names_by_service = container_names_by_service
|
self.container_names_by_service = container_names_by_service
|
||||||
container_by_name = dict([(c["name"], c) for c in given_containers])
|
container_by_name = dict([(c["name"], c) for c in given_containers])
|
||||||
#log("deps:", [(c["name"], c["_deps"]) for c in given_containers])
|
#log("deps:", [(c["name"], c["_deps"]) for c in given_containers])
|
||||||
|
Loading…
Reference in New Issue
Block a user