fix(compose-volumes): keep the meta nfs flag on an injected volume of the same key

compose_volumes merged extra_volumes first and then skipped every meta/volumes.yml entry whose key was already present, so the meta nfs value was lost with it. Nextcloud injects talk_recording_tmp through nextcloud_extra_volumes without an nfs key, and 5728502a19 marked that volume nfs: false. On swarm with the NFS backend the stack therefore bound it to /var/lib/infinito/nextcloud_talk_recording_tmp, while nfs_prep.yml renders the same lookup without extras, saw nfs: false and never created the subdir; every node rejected the task with 'no such file or directory'. The meta nfs value now carries over onto the injected or derived spec unless that spec sets nfs itself, so both renders agree and the scratch volume stays node-local.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5.5 committed 2026-10-30 21:31:59 +01:00
1 parent f27d8369d7
commit a23500a270
2 files changed
+46

No files matched your search

@@ -343,6 +343,49 @@ class TestComposeVolumes(unittest.TestCase):
self.assertEqual(data["volumes"]["repositories"], {"name": "app_repositories"})
self.assertIn("driver_opts", data["volumes"]["shared"])
def test_swarm_meta_nfs_false_survives_extra_volume_with_same_key(self):
apps = self._base_apps()
apps["app"]["volumes"] = {
"scratch": {
"type": "volume",
"name": "app_scratch",
"nfs": False,
"mounts": [{"service": "recorder", "target": "/tmp"}],
},
"shared_tmp": {
"type": "volume",
"name": "app_shared_tmp",
"mounts": [{"service": "board", "target": "/tmp"}],
},
}
swarm_nfs = {
"deployment_mode": "swarm",
"storage": {
"backend": "nfs",
"nfs": {"server": "10.0.0.20", "export_base": "/srv/nfs"},
},
}
stack = self._parse_yaml(
_call(
apps,
"app",
extra_volumes={
"scratch": {"name": "app_scratch"},
"shared_tmp": {"name": "app_shared_tmp"},
},
**swarm_nfs,
)
)
prep = self._parse_yaml(_call(apps, "app", **swarm_nfs))
self.assertEqual(stack["volumes"]["scratch"], {"name": "app_scratch"})
self.assertEqual(stack["volumes"]["scratch"], prep["volumes"]["scratch"])
self.assertEqual(
stack["volumes"]["shared_tmp"]["driver_opts"]["device"],
f"{_DIR_VAR_LIB}/app_shared_tmp",
)
self.assertEqual(stack["volumes"]["shared_tmp"], prep["volumes"]["shared_tmp"])
def test_swarm_nfs_dict_value_keeps_rewrite(self):
apps = self._base_apps()
apps["app"]["volumes"] = {