From 2c8ebcaa9f8954549a0d6f3758b648cece0ba9c4 Mon Sep 17 00:00:00 2001 From: MacRimi <123239993+MacRimi@users.noreply.github.com> Date: Sat, 17 Oct 2026 21:21:30 +0200 Subject: [PATCH] fix(oci): count only paths added by hand in the Modify menu - Leave the application's own volumes out of the Extra paths count - Add a regression test for the count --- oci/src/proxmenux_oci/recreation.py | 3 ++- oci/tests/test_modify_menu.py | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/oci/src/proxmenux_oci/recreation.py b/oci/src/proxmenux_oci/recreation.py index f0d6f691..e1f3d897 100644 --- a/oci/src/proxmenux_oci/recreation.py +++ b/oci/src/proxmenux_oci/recreation.py @@ -120,7 +120,8 @@ def modification_options(candidate): ('memory', row(translate('RAM in MiB'), resources['memory_mb'])), ('network', row(translate('Network'), f"{network.get('bridge', '-')} ยท {'DHCP' if address == 'dhcp' else address}")), - ('paths', row(translate('Extra paths'), len(deployment.get('mounts', [])))), + # Only the paths added by hand: the application's own volumes are not extra. + ('paths', row(translate('Extra paths'), sum(1 for m in deployment.get('mounts', []) if m.get('custom')))), ] if profile.get('shared_directories'): options.append(('shares', translate('Shared directories'))) diff --git a/oci/tests/test_modify_menu.py b/oci/tests/test_modify_menu.py index 2709da4f..601c588e 100644 --- a/oci/tests/test_modify_menu.py +++ b/oci/tests/test_modify_menu.py @@ -147,6 +147,13 @@ class ModifyMenuTests(unittest.TestCase): recreation.edit_recreation(record(), ui) self.assertNotIn('private-test-secret', json.dumps(ui.events)) + def test_extra_paths_counts_only_paths_added_by_hand(self, _language): + candidate = record() + self.assertTrue(dict(recreation.modification_options(candidate))['paths'].rstrip().endswith(' 0')) + candidate['deployment']['mounts'].append({'container_path': '/media-extra', 'type': 'host-bind', + 'source': '/mnt/media', 'custom': True}) + self.assertTrue(dict(recreation.modification_options(candidate))['paths'].rstrip().endswith(' 1')) + def test_optional_categories_follow_the_application_profile(self, _language): candidate = record() options = dict(recreation.modification_options(candidate))