gofmt code

This commit is contained in:
Chris Chalfant 2016-03-14 13:49:42 -04:00
parent 72a7123a0b
commit 8163e16e02
3 changed files with 21 additions and 21 deletions

View File

@ -23,8 +23,8 @@ type RunConfig struct {
SourceAmi string `mapstructure:"source_ami"` SourceAmi string `mapstructure:"source_ami"`
SpotPrice string `mapstructure:"spot_price"` SpotPrice string `mapstructure:"spot_price"`
SpotPriceAutoProduct string `mapstructure:"spot_price_auto_product"` SpotPriceAutoProduct string `mapstructure:"spot_price_auto_product"`
DisableStopInstance bool `mapstructure:"disable_stop_instance"` DisableStopInstance bool `mapstructure:"disable_stop_instance"`
SecurityGroupId string `mapstructure:"security_group_id"` SecurityGroupId string `mapstructure:"security_group_id"`
SecurityGroupIds []string `mapstructure:"security_group_ids"` SecurityGroupIds []string `mapstructure:"security_group_ids"`
SubnetId string `mapstructure:"subnet_id"` SubnetId string `mapstructure:"subnet_id"`
TemporaryKeyPairName string `mapstructure:"temporary_key_pair_name"` TemporaryKeyPairName string `mapstructure:"temporary_key_pair_name"`

View File

@ -151,9 +151,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
}, },
&common.StepProvision{}, &common.StepProvision{},
&stepStopInstance{ &stepStopInstance{
SpotPrice: b.config.SpotPrice, SpotPrice: b.config.SpotPrice,
DisableStopInstance: b.config.DisableStopInstance, DisableStopInstance: b.config.DisableStopInstance,
}, },
// TODO(mitchellh): verify works with spots // TODO(mitchellh): verify works with spots
&stepModifyInstance{}, &stepModifyInstance{},
&awscommon.StepDeregisterAMI{ &awscommon.StepDeregisterAMI{

View File

@ -10,8 +10,8 @@ import (
) )
type stepStopInstance struct { type stepStopInstance struct {
SpotPrice string SpotPrice string
DisableStopInstance bool DisableStopInstance bool
} }
func (s *stepStopInstance) Run(state multistep.StateBag) multistep.StepAction { func (s *stepStopInstance) Run(state multistep.StateBag) multistep.StepAction {
@ -24,21 +24,21 @@ func (s *stepStopInstance) Run(state multistep.StateBag) multistep.StepAction {
return multistep.ActionContinue return multistep.ActionContinue
} }
var err error var err error
if s.DisableStopInstance == false { if s.DisableStopInstance == false {
// Stop the instance so we can create an AMI from it // Stop the instance so we can create an AMI from it
ui.Say("Stopping the source instance...") ui.Say("Stopping the source instance...")
_, err = ec2conn.StopInstances(&ec2.StopInstancesInput{ _, err = ec2conn.StopInstances(&ec2.StopInstancesInput{
InstanceIds: []*string{instance.InstanceId}, InstanceIds: []*string{instance.InstanceId},
}) })
if err != nil { if err != nil {
err := fmt.Errorf("Error stopping instance: %s", err) err := fmt.Errorf("Error stopping instance: %s", err)
state.Put("error", err) state.Put("error", err)
ui.Error(err.Error()) ui.Error(err.Error())
return multistep.ActionHalt return multistep.ActionHalt
} }
} }
// Wait for the instance to actual stop // Wait for the instance to actual stop
ui.Say("Waiting for the instance to stop...") ui.Say("Waiting for the instance to stop...")