prvng_core/nulib/images/update.nu

23 lines
630 B
Text
Raw Normal View History

# Image update — delete old snapshot then rebuild role image.
use ./state.nu *
use ./delete.nu *
use ./create.nu *
export def image-update [
role: string
--provider: string = "hetzner"
--infra: string = ""
--check
] {
let state = (image-state-read $provider $role)
if $state.snapshot_id != "SNAPSHOT_PENDING" {
print $"Removing stale snapshot ($state.snapshot_id) for '($provider)/($role)'..."
image-delete $role --provider $provider --yes
} else {
print $"No existing snapshot — proceeding with fresh build."
}
image-create $role --infra $infra --check=$check
}