diff --git a/builder/proxmox/step_type_boot_command.go b/builder/proxmox/step_type_boot_command.go index 2e87cb7e5..89d50fb0d 100644 --- a/builder/proxmox/step_type_boot_command.go +++ b/builder/proxmox/step_type_boot_command.go @@ -11,6 +11,7 @@ import ( "github.com/Telmate/proxmox-api-go/proxmox" "github.com/hashicorp/packer/common" "github.com/hashicorp/packer/common/bootcommand" + commonhelper "github.com/hashicorp/packer/helper/common" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/template/interpolate" @@ -96,7 +97,9 @@ func (s *stepTypeBootCommand) Run(ctx context.Context, state multistep.StateBag) return multistep.ActionContinue } -func (*stepTypeBootCommand) Cleanup(multistep.StateBag) {} +func (*stepTypeBootCommand) Cleanup(multistep.StateBag) { + commonhelper.RemoveSharedStateFile("ip", "") +} func hostIP() (string, error) { addrs, err := net.InterfaceAddrs() diff --git a/builder/proxmox/step_type_boot_command_test.go b/builder/proxmox/step_type_boot_command_test.go index b2f285c04..c51b57d73 100644 --- a/builder/proxmox/step_type_boot_command_test.go +++ b/builder/proxmox/step_type_boot_command_test.go @@ -115,6 +115,8 @@ func TestTypeBootCommand(t *testing.T) { c.builderConfig.ctx, } action := step.Run(context.TODO(), state) + step.Cleanup(state) + if action != c.expectedAction { t.Errorf("Expected action to be %v, got %v", c.expectedAction, action) }