diff --git a/builder/hcloud/config.go b/builder/hcloud/config.go index f3ee151a..bb148779 100644 --- a/builder/hcloud/config.go +++ b/builder/hcloud/config.go @@ -45,8 +45,8 @@ type Config struct { ConnectWithPrivateIP bool `mapstructure:"connect_with_private_ip"` Subnet string `mapstructure:"subnet"` MaxSnapshots int `mapstructure:"max_snapshots"` - SkipImageCreation bool `mapstructure:"skip_image_creation"` - RescueMode string `mapstructure:"rescue"` + SkipImageCreation bool `mapstructure:"skip_image_creation"` + RescueMode string `mapstructure:"rescue"` ctx interpolate.Context } diff --git a/builder/hcloud/step_create_snapshot.go b/builder/hcloud/step_create_snapshot.go index 995a11bf..fc4c336f 100644 --- a/builder/hcloud/step_create_snapshot.go +++ b/builder/hcloud/step_create_snapshot.go @@ -5,7 +5,7 @@ import ( "fmt" "reflect" "sort" - + "github.com/hashicorp/packer-plugin-sdk/multistep" packersdk "github.com/hashicorp/packer-plugin-sdk/packer" "github.com/hetznercloud/hcloud-go/hcloud" @@ -22,13 +22,11 @@ func (s *stepCreateSnapshot) Run(ctx context.Context, state multistep.StateBag) c := state.Get("config").(*Config) serverID := state.Get("server_id").(int) - if c.SkipImageCreation == true { ui.Say("Skip creation of snapshot ...") return multistep.ActionContinue } - if c.MaxSnapshots != 0 { opts := hcloud.ImageListOpts{Type: []hcloud.ImageType{hcloud.ImageTypeSnapshot}} snapshots, err := client.Image.AllWithOpts(ctx, opts) diff --git a/builder/hcloud/step_pre_validate_network.go b/builder/hcloud/step_pre_validate_network.go index afd72519..54d1237a 100644 --- a/builder/hcloud/step_pre_validate_network.go +++ b/builder/hcloud/step_pre_validate_network.go @@ -17,7 +17,6 @@ import ( // type stepPreValidateNetwork struct { net_id int - srv_ip string } func (s *stepPreValidateNetwork) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { @@ -90,9 +89,7 @@ func (s *stepPreValidateNetwork) Run(ctx context.Context, state multistep.StateB for _, x := range server.PrivateNet { server_ip_array = append(server_ip_array, x.IP) if len(x.Aliases) != 0 { - for _, y := range x.Aliases { - server_ip_array = append(server_ip_array, y) - } + server_ip_array = append(server_ip_array, x.Aliases...) } } }