From 44cb274bcce480ef66e5571d277e42f7ece68c9f Mon Sep 17 00:00:00 2001 From: Grzegorz Wierzowiecki <221403+gwpl@users.noreply.github.com> Date: Tue, 24 Mar 2026 11:45:47 +0100 Subject: [PATCH] Show actual disk size instead of size spec in resize command (#51) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Show actual disk size instead of size spec in resize command After a --no-disk resize, `dropkit resize` showed the size spec's disk (e.g. 80 GB for s-2vcpu-4gb) instead of the droplet's actual disk (25 GB). This is confusing for users planning temporary scale-ups — they need to see their real disk to know if they can scale back down. Read disk from `droplet["disk"]` (actual allocation) instead of `droplet["size"]["disk"]` (what the size tier offers). When the two differ, show an inline hint: "25 GB (size spec: 80 GB, disk was not resized)" so the situation is immediately clear. Co-Authored-By: Claude Opus 4.6 (1M context) * Use actual droplet vcpus and memory, not just disk Read all three resource fields from the droplet object directly (droplet["vcpus"], droplet["memory"], droplet["disk"]) instead of from the size spec (droplet["size"]["vcpus"], etc.). After a --no-disk resize these can diverge — the size spec reflects the new tier while the droplet retains its original resources. Co-Authored-By: Claude Opus 4.6 (1M context) --------- Co-authored-by: Claude Opus 4.6 (1M context) --- dropkit/main.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/dropkit/main.py b/dropkit/main.py index 6b70616..0d426f9 100644 --- a/dropkit/main.py +++ b/dropkit/main.py @@ -3362,14 +3362,31 @@ def resize( current_table.add_column(style="dim") current_table.add_column(style="white") - current_vcpus = current_size_info.get("vcpus", "N/A") - current_memory = current_size_info.get("memory", "N/A") - current_disk = current_size_info.get("disk", "N/A") + # Use the droplet's actual resource values, not the size spec's. + # After a --no-disk resize, the size spec reflects the new tier + # (e.g. 80 GB disk for s-2vcpu-4gb) while the droplet's actual + # resources may differ (e.g. still 25 GB disk). + current_vcpus = droplet.get("vcpus", current_size_info.get("vcpus", "N/A")) + current_memory = droplet.get("memory", current_size_info.get("memory", "N/A")) + current_disk = droplet.get("disk", current_size_info.get("disk", "N/A")) current_price = current_size_info.get("price_monthly", 0) current_table.add_row("vCPUs:", str(current_vcpus)) current_table.add_row("Memory:", f"{current_memory} MB") - current_table.add_row("Disk:", f"{current_disk} GB") + # Show hint when actual disk is smaller than the size spec + # (happens after a previous --no-disk resize) + spec_disk = current_size_info.get("disk") + if ( + isinstance(current_disk, int) + and isinstance(spec_disk, int) + and current_disk < spec_disk + ): + current_table.add_row( + "Disk:", + f"{current_disk} GB [dim](size spec: {spec_disk} GB, disk was not resized)[/dim]", + ) + else: + current_table.add_row("Disk:", f"{current_disk} GB") current_table.add_row("Price:", f"${current_price:.2f}/month") console.print(current_table)