builder/amazon/common: on modify AMI attributes, skip if no work

/cc @jmassara
This commit is contained in:
Mitchell Hashimoto 2013-08-08 22:46:22 -07:00
parent dcfbef4fc0
commit 96a91e9555
1 changed files with 11 additions and 0 deletions

View File

@ -20,6 +20,17 @@ func (s *StepModifyAttributes) Run(state map[string]interface{}) multistep.StepA
amis := state["amis"].(map[string]string) amis := state["amis"].(map[string]string)
ami := amis[ec2conn.Region.Name] ami := amis[ec2conn.Region.Name]
// Determine if there is any work to do.
valid := false
valid = valid || s.Description != ""
valid = valid || (s.Users != nil && len(s.Users) > 0)
valid = valid || (s.Groups != nil && len(s.Groups) > 0)
valid = valid || (s.ProductCodes != nil && len(s.ProductCodes) > 0)
if !valid {
return multistep.ActionContinue
}
options := &ec2.ModifyImageAttribute{ options := &ec2.ModifyImageAttribute{
Description: s.Description, Description: s.Description,
AddUsers: s.Users, AddUsers: s.Users,