Revert "Merge pull request #663 from ktruong7/public-AMI"
This reverts commitb2fc77870b
, reversing changes made to4789d3acc8
. This is already possible by setting groups.
This commit is contained in:
parent
09b53212bb
commit
5d420ce1c1
|
@ -202,7 +202,6 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
||||||
Description: b.config.AMIDescription,
|
Description: b.config.AMIDescription,
|
||||||
Users: b.config.AMIUsers,
|
Users: b.config.AMIUsers,
|
||||||
Groups: b.config.AMIGroups,
|
Groups: b.config.AMIGroups,
|
||||||
Visibility: b.config.AMIVisibility,
|
|
||||||
},
|
},
|
||||||
&awscommon.StepCreateTags{
|
&awscommon.StepCreateTags{
|
||||||
Tags: b.config.AMITags,
|
Tags: b.config.AMITags,
|
||||||
|
|
|
@ -15,7 +15,6 @@ type AMIConfig struct {
|
||||||
AMIProductCodes []string `mapstructure:"ami_product_codes"`
|
AMIProductCodes []string `mapstructure:"ami_product_codes"`
|
||||||
AMIRegions []string `mapstructure:"ami_regions"`
|
AMIRegions []string `mapstructure:"ami_regions"`
|
||||||
AMITags map[string]string `mapstructure:"tags"`
|
AMITags map[string]string `mapstructure:"tags"`
|
||||||
AMIVisibility string `mapstructure:"ami_visibility"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *AMIConfig) Prepare(t *packer.ConfigTemplate) []error {
|
func (c *AMIConfig) Prepare(t *packer.ConfigTemplate) []error {
|
||||||
|
@ -30,7 +29,6 @@ func (c *AMIConfig) Prepare(t *packer.ConfigTemplate) []error {
|
||||||
templates := map[string]*string{
|
templates := map[string]*string{
|
||||||
"ami_name": &c.AMIName,
|
"ami_name": &c.AMIName,
|
||||||
"ami_description": &c.AMIDescription,
|
"ami_description": &c.AMIDescription,
|
||||||
"ami_visibility": &c.AMIVisibility,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
errs := make([]error, 0)
|
errs := make([]error, 0)
|
||||||
|
|
|
@ -13,7 +13,6 @@ type StepModifyAMIAttributes struct {
|
||||||
Groups []string
|
Groups []string
|
||||||
ProductCodes []string
|
ProductCodes []string
|
||||||
Description string
|
Description string
|
||||||
Visibility string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepModifyAMIAttributes) Run(state multistep.StateBag) multistep.StepAction {
|
func (s *StepModifyAMIAttributes) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
|
@ -27,7 +26,6 @@ func (s *StepModifyAMIAttributes) Run(state multistep.StateBag) multistep.StepAc
|
||||||
valid = valid || (s.Users != nil && len(s.Users) > 0)
|
valid = valid || (s.Users != nil && len(s.Users) > 0)
|
||||||
valid = valid || (s.Groups != nil && len(s.Groups) > 0)
|
valid = valid || (s.Groups != nil && len(s.Groups) > 0)
|
||||||
valid = valid || (s.ProductCodes != nil && len(s.ProductCodes) > 0)
|
valid = valid || (s.ProductCodes != nil && len(s.ProductCodes) > 0)
|
||||||
valid = valid || s.Visibility == "public"
|
|
||||||
|
|
||||||
if !valid {
|
if !valid {
|
||||||
return multistep.ActionContinue
|
return multistep.ActionContinue
|
||||||
|
@ -61,14 +59,6 @@ func (s *StepModifyAMIAttributes) Run(state multistep.StateBag) multistep.StepAc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.Visibility == "public" {
|
|
||||||
group := make([]string, 1)
|
|
||||||
group[0] = "all"
|
|
||||||
options["public ami"] = &ec2.ModifyImageAttribute{
|
|
||||||
AddGroups: group,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for region, ami := range amis {
|
for region, ami := range amis {
|
||||||
ui.Say(fmt.Sprintf("Modifying attributes on AMI (%s)...", ami))
|
ui.Say(fmt.Sprintf("Modifying attributes on AMI (%s)...", ami))
|
||||||
regionconn := ec2.New(ec2conn.Auth, aws.Regions[region])
|
regionconn := ec2.New(ec2conn.Auth, aws.Regions[region])
|
||||||
|
|
|
@ -119,7 +119,6 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
||||||
Description: b.config.AMIDescription,
|
Description: b.config.AMIDescription,
|
||||||
Users: b.config.AMIUsers,
|
Users: b.config.AMIUsers,
|
||||||
Groups: b.config.AMIGroups,
|
Groups: b.config.AMIGroups,
|
||||||
Visibility: b.config.AMIVisibility,
|
|
||||||
},
|
},
|
||||||
&awscommon.StepCreateTags{
|
&awscommon.StepCreateTags{
|
||||||
Tags: b.config.AMITags,
|
Tags: b.config.AMITags,
|
||||||
|
|
|
@ -225,7 +225,6 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
||||||
Users: b.config.AMIUsers,
|
Users: b.config.AMIUsers,
|
||||||
Groups: b.config.AMIGroups,
|
Groups: b.config.AMIGroups,
|
||||||
ProductCodes: b.config.AMIProductCodes,
|
ProductCodes: b.config.AMIProductCodes,
|
||||||
Visibility: b.config.AMIVisibility,
|
|
||||||
},
|
},
|
||||||
&awscommon.StepCreateTags{
|
&awscommon.StepCreateTags{
|
||||||
Tags: b.config.AMITags,
|
Tags: b.config.AMITags,
|
||||||
|
|
Loading…
Reference in New Issue