Skip to content

Commit

Permalink
fmt and linking to pass CI
Browse files Browse the repository at this point in the history
  • Loading branch information
daparm committed Feb 6, 2022
1 parent 5dfd774 commit ca792f8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
4 changes: 2 additions & 2 deletions builder/hcloud/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 1 addition & 3 deletions builder/hcloud/step_create_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
Expand Down
5 changes: 1 addition & 4 deletions builder/hcloud/step_pre_validate_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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...)
}
}
}
Expand Down

0 comments on commit ca792f8

Please sign in to comment.