Skip to content

Commit

Permalink
Check InitSleep validity before spawning the container
Browse files Browse the repository at this point in the history
  • Loading branch information
vheon committed Nov 6, 2023
1 parent 64bde2e commit 1eb40e2
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions builder/lxd/step_lxd_launch.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,18 @@ func (s *stepLxdLaunch) Run(ctx context.Context, state multistep.StateBag) multi
launch_args = append(launch_args, "--config", fmt.Sprintf("%s=%s", k, v))
}

ui.Say("Creating container...")
_, err := LXDCommand(launch_args...)
sleep_seconds, err := strconv.Atoi(config.InitSleep)
if err != nil {
err := fmt.Errorf("Error creating container: %s", err)
err := fmt.Errorf("Error parsing InitSleep into int: %s", err)
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
}
sleep_seconds, err := strconv.Atoi(config.InitSleep)

ui.Say("Creating container...")
_, err = LXDCommand(launch_args...)
if err != nil {
err := fmt.Errorf("Error parsing InitSleep into int: %s", err)
err := fmt.Errorf("Error creating container: %s", err)
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
Expand Down

0 comments on commit 1eb40e2

Please sign in to comment.