[DEPLOY] CT110 и CT111 под compose; генератор сохраняет существующие тома
lint / hygiene (push) Successful in 16s
lint / hygiene (push) Successful in 16s
This commit is contained in:
1 parent
a75af71407
commit
679e5fffbf
3 files changed
+29
-7
No files matched your search
@@ -83,8 +83,10 @@ def build(ct):
|
||||
if m.get("Type") == "bind":
|
||||
vols.append(f'{m["Source"]}:{m["Destination"]}' + (":ro" if not m.get("RW", True) else ""))
|
||||
elif m.get("Type") == "volume":
|
||||
vname = f'{name}-{m["Destination"].strip("/").replace("/", "-")}'
|
||||
volumes[vname] = {}
|
||||
# сохраняем существующий том как есть (external), иначе
|
||||
# compose создаст новый пустой и данные пропадут
|
||||
vname = m.get("Name") or f'{name}-{m["Destination"].strip("/").replace("/", "-")}'
|
||||
volumes[vname] = {"external": True} if m.get("Name") else {}
|
||||
vols.append(f'{vname}:{m["Destination"]}')
|
||||
if vols:
|
||||
svc["volumes"] = vols
|
||||
@@ -151,7 +153,11 @@ def yaml_dump(services, volumes, networks):
|
||||
if volumes:
|
||||
L.append("volumes:")
|
||||
for v in sorted(volumes):
|
||||
L.append(f" {v}: {{}}")
|
||||
if volumes[v] == {"external": True}:
|
||||
L.append(f" {v}:")
|
||||
L.append(" external: true")
|
||||
else:
|
||||
L.append(f" {v}: {{}}")
|
||||
if networks:
|
||||
L.append("networks:")
|
||||
for n in sorted(networks):
|
||||
|
||||
Reference in new issue
Block a user