Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fernflower committed Jan 20, 2025
1 parent d20882d commit 9f9ede9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion builder/powervs/builder.hcl2spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions builder/powervs/common/run_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ type CaptureCOS struct {
}

type RunConfig struct {
InstanceName string `mapstructure:"instance_name" required:"true"`
KeyPairName string `mapstructure:"key_pair_name" required:"true"`
SubnetIDs []string `mapstructure:"subnet_ids" required:"false"`
UserData string `mapstructure:"user_data" required:"false"`
DHCPNetwork bool `mapstructure:"dhcp_network" required:"false"`
Source Source `mapstructure:"source" required:"true"`
Capture Capture `mapstructure:"capture" required:"true"`
InstanceName string `mapstructure:"instance_name" required:"true"`
KeyPairName string `mapstructure:"key_pair_name" required:"true"`
SubnetIDs []string `mapstructure:"subnet_ids" required:"false"`
UserData string `mapstructure:"user_data" required:"false"`
DHCPNetwork bool `mapstructure:"dhcp_network" required:"false"`
Source Source `mapstructure:"source" required:"true"`
Capture Capture `mapstructure:"capture" required:"true"`

// Communicator settings
Comm communicator.Config `mapstructure:",squash"`
Expand Down
6 changes: 3 additions & 3 deletions builder/powervs/step_create_instance.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package powervs

import (
b64 "encoding/base64"
"context"
b64 "encoding/base64"
"fmt"
"time"

Expand Down Expand Up @@ -37,12 +37,12 @@ func (s *StepCreateInstance) Run(_ context.Context, state multistep.StateBag) mu
// Several subnets have been specified -> pass them all for vm creation
networks = []*models.PVMInstanceAddNetwork{}

for _, subnet := range state.Get("networks").([]string){
for _, subnet := range state.Get("networks").([]string) {
subnetAdd := &models.PVMInstanceAddNetwork{
NetworkID: &subnet,
}
networks = append(networks, subnetAdd)
}
}
} else {
networks = append(networks, &models.PVMInstanceAddNetwork{NetworkID: net.NetworkID})
}
Expand Down
9 changes: 4 additions & 5 deletions builder/powervs/step_create_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ const (
)

type StepCreateNetwork struct {
SubnetIDs []string
DHCPNetwork bool
doCleanup bool
SubnetIDs []string
DHCPNetwork bool
doCleanup bool
}


func (s *StepCreateNetwork) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
ui := state.Get("ui").(packersdk.Ui)

Expand All @@ -50,7 +49,7 @@ func (s *StepCreateNetwork) Run(_ context.Context, state multistep.StateBag) mul
// do not delete user specified subnets, hence skipping the cleanup
s.doCleanup = false
return multistep.ActionContinue
}
}

// If CreateDHCPNetwork is set, Create DHCP network.
if s.DHCPNetwork {
Expand Down

0 comments on commit 9f9ede9

Please sign in to comment.