diff --git a/README.md b/README.md index ed2a696..54d7418 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ Shared storage IDs are scanned once; local storage remains scoped to its node. Results are grouped by node and storage, with volume IDs and disk sizes in readable units (MiB, GiB, or TiB). CSV includes both `disk_size` and `size_bytes`. When Proxmox supplies only `approximate-size`, the display and CSV -show a `~` prefix and CSV sets `size_is_approximate` to `True`. Exact sizes take +show a `~` prefix. Exact sizes take precedence; unavailable sizes are displayed as `Unknown`. Backups, ISOs, unmanaged files, and physical/passthrough disks are excluded. diff --git a/defaults.inc b/defaults.inc index 943631d..d01ab4c 100755 --- a/defaults.inc +++ b/defaults.inc @@ -3,7 +3,7 @@ action="${1:-}" FOLDER='/opt/idssys/ta-proxmenu' -VERS='2026.9.22-11' +VERS='2026.9.22-13' noupdate=' ' diff --git a/inc/orphan-disks.py b/inc/orphan-disks.py index 337cc3c..6c4bd5e 100755 --- a/inc/orphan-disks.py +++ b/inc/orphan-disks.py @@ -219,10 +219,13 @@ def export_csv(path, rows): suffix += 1 destination = base.with_name(f'{base.stem}-{suffix}.csv') with handle: - writer = csv.DictWriter(handle, fieldnames=FIELDS + ['disk_size']) + export_fields = [field for field in FIELDS if field != 'size_is_approximate'] + writer = csv.DictWriter(handle, fieldnames=export_fields + ['disk_size']) writer.writeheader() for row in rows: - writer.writerow(dict(row, disk_size=format_size(row['size_bytes'], row.get('size_is_approximate', False)))) + exported = {field: row.get(field) for field in export_fields} + exported['disk_size'] = format_size(row['size_bytes'], row.get('size_is_approximate', False)) + writer.writerow(exported) return destination diff --git a/proxmenu-scripts.sh b/proxmenu-scripts.sh index ee9d09f..59ae4f7 100755 --- a/proxmenu-scripts.sh +++ b/proxmenu-scripts.sh @@ -1880,13 +1880,13 @@ SELECT_MENU() { "") MENU_INPUT="enter" MENU_SELECTION="${values_ref[$selected]}" - return 0 + break ;; " ") if (( allow_space == 1 )); then MENU_INPUT="space" MENU_SELECTION="${values_ref[$selected]}" - return 0 + break fi ;; [1-9]) @@ -1896,17 +1896,17 @@ SELECT_MENU() { MENU_SELECTED_INDEX="$selected" MENU_INPUT="number" MENU_SELECTION="${values_ref[$index]}" - return 0 + break fi ;; [Qq]) MENU_SELECTION="quit" - return 0 + break ;; [Bb]) if (( allow_back == 1 )); then MENU_SELECTION="back" - return 0 + break fi ;; $'\e') @@ -1921,12 +1921,12 @@ SELECT_MENU() { ;; "[C"|"OC") MENU_SELECTION="${values_ref[$selected]}" - return 0 + break ;; "[D"|"OD"|"") if (( allow_back == 1 )); then MENU_SELECTION="back" - return 0 + break fi ;; "[H") @@ -1939,6 +1939,11 @@ SELECT_MENU() { ;; esac done + + # Leave only the header above the selected action's output. + MENU_HEADER + echo + return 0 } TAPM_POST_PROFILE_SUMMARY() { diff --git a/tests/test-orphan-disks.py b/tests/test-orphan-disks.py index af8f1b6..d76bb1b 100644 --- a/tests/test-orphan-disks.py +++ b/tests/test-orphan-disks.py @@ -165,7 +165,7 @@ class ReportTests(unittest.TestCase): self.assertEqual([row['disk_size'] for row in exported], ['~25.91 GiB', '30.00 GiB', '0.00 B', '~25.91 GiB', 'Unknown']) self.assertEqual(exported[0]['size_bytes'], str(approximate)) - self.assertEqual(exported[0]['size_is_approximate'], 'True') + self.assertNotIn('size_is_approximate', exported[0]) def test_offline_node_and_config_change(self): def get(path, *options):