From 6699a4afbb56c9017a8d4e7e906b3949c6f33cd8 Mon Sep 17 00:00:00 2001 From: MacRimi <123239993+MacRimi@users.noreply.github.com> Date: Thu, 22 Oct 2026 10:52:35 +0200 Subject: [PATCH] fix(oci): keep installing when an image mountpoint is not a plain directory - Log and continue when the helper refuses a mountpoint, as the seed capture does - Nothing is moved in that case, so the image installs as before --- oci/remote/install_generic_stack.py | 6 +++++- oci/remote/install_oci.sh | 5 ++++- oci/tests/test_image_mountpoints.py | 10 ++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/oci/remote/install_generic_stack.py b/oci/remote/install_generic_stack.py index 102ca7f5..6d7794be 100644 --- a/oci/remote/install_generic_stack.py +++ b/oci/remote/install_generic_stack.py @@ -407,7 +407,11 @@ def attach_mounts(service, temporary): owner = (100000,100000,0o755) if mount['type'] == 'managed-volume': from oci_image_mountpoints import normalize - normalize(root, [mount['container_path']]) + try: + normalize(root, [mount['container_path']]) + except (OSError, ValueError) as error: + # Nothing was moved; the image keeps its files as before. + print(f'Image defaults left in place for {mount["container_path"]}: {error}', file=sys.stderr) finally: run('pct','unmount',vmid) if mount['type']=='managed-volume': diff --git a/oci/remote/install_oci.sh b/oci/remote/install_oci.sh index f0981c00..c68bf449 100755 --- a/oci/remote/install_oci.sh +++ b/oci/remote/install_oci.sh @@ -524,7 +524,10 @@ capture_volume_seeds() { if (( failed == 0 )); then # Data seeds were captured first; prepare the raw image even when the # transaction will reuse a persistent disk and therefore skipped seeding. - oci_quiet python3 "$SCRIPT_DIR/oci_image_mountpoints.py" "$rootfs" "$DEPLOYMENT_FILE" || failed=1 + # The helper changes nothing when it refuses a path (a link, another + # filesystem); the image then installs as it did before. + oci_quiet python3 "$SCRIPT_DIR/oci_image_mountpoints.py" "$rootfs" "$DEPLOYMENT_FILE" \ + || oci_log "Image defaults left in place: a volume mountpoint of the image is not a plain directory" fi if (( mounted == 1 )); then oci_quiet pct unmount "$VMID" || failed=1 diff --git a/oci/tests/test_image_mountpoints.py b/oci/tests/test_image_mountpoints.py index 3273aab0..96757736 100644 --- a/oci/tests/test_image_mountpoints.py +++ b/oci/tests/test_image_mountpoints.py @@ -119,5 +119,15 @@ class ImageMountpointTests(unittest.TestCase): self.assertEqual(self.normalize(), []) + def test_installers_keep_installing_when_a_mountpoint_is_refused(self): + # A refused path changes nothing, so the image installs as it did before. + remote = MODULE.parent + script = (remote / 'install_oci.sh').read_text() + call = script[script.index('oci_image_mountpoints.py'):] + self.assertTrue(call.split('\n', 2)[1].strip().startswith('|| oci_log')) + stack = (remote / 'install_generic_stack.py').read_text() + block = stack[stack.index('normalize(root, [mount'):][:400] + self.assertIn('except (OSError, ValueError)', block) + if __name__ == '__main__': unittest.main()