simplify code flow: skip the step if no run_volume_tags provided

This commit is contained in:
Roman Zhuzha 2017-01-18 13:03:05 +01:00
parent a65af51a4b
commit ae016a1f25
1 changed files with 24 additions and 23 deletions

View File

@ -18,7 +18,9 @@ func (s *stepTagEBSVolumes) Run(state multistep.StateBag) multistep.StepAction {
instance := state.Get("instance").(*ec2.Instance) instance := state.Get("instance").(*ec2.Instance)
ui := state.Get("ui").(packer.Ui) ui := state.Get("ui").(packer.Ui)
if len(s.VolumeRunTags) > 0 { if len(s.VolumeRunTags) == 0 {
return multistep.ActionContinue
}
volumeIds := make([]*string, 0) volumeIds := make([]*string, 0)
for _, v := range instance.BlockDeviceMappings { for _, v := range instance.BlockDeviceMappings {
@ -46,7 +48,6 @@ func (s *stepTagEBSVolumes) Run(state multistep.StateBag) multistep.StepAction {
ui.Error(err.Error()) ui.Error(err.Error())
return multistep.ActionHalt return multistep.ActionHalt
} }
}
return multistep.ActionContinue return multistep.ActionContinue
} }