Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
3589b0ba
Commit
3589b0ba
authored
Nov 26, 2013
by
ktruong7
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added option to make ami public automatically
parent
27063b23
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
0 deletions
+15
-0
builder/amazon/chroot/builder.go
builder/amazon/chroot/builder.go
+1
-0
builder/amazon/common/ami_config.go
builder/amazon/common/ami_config.go
+2
-0
builder/amazon/common/step_modify_ami_attributes.go
builder/amazon/common/step_modify_ami_attributes.go
+10
-0
builder/amazon/ebs/builder.go
builder/amazon/ebs/builder.go
+1
-0
builder/amazon/instance/builder.go
builder/amazon/instance/builder.go
+1
-0
No files found.
builder/amazon/chroot/builder.go
View file @
3589b0ba
...
...
@@ -202,6 +202,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
Description
:
b
.
config
.
AMIDescription
,
Users
:
b
.
config
.
AMIUsers
,
Groups
:
b
.
config
.
AMIGroups
,
Visibility
:
b
.
config
.
AMIVisibility
,
},
&
awscommon
.
StepCreateTags
{
Tags
:
b
.
config
.
AMITags
,
...
...
builder/amazon/common/ami_config.go
View file @
3589b0ba
...
...
@@ -15,6 +15,7 @@ type AMIConfig struct {
AMIProductCodes
[]
string
`mapstructure:"ami_product_codes"`
AMIRegions
[]
string
`mapstructure:"ami_regions"`
AMITags
map
[
string
]
string
`mapstructure:"tags"`
AMIVisibility
string
`mapstructure:"ami_visibility"`
}
func
(
c
*
AMIConfig
)
Prepare
(
t
*
packer
.
ConfigTemplate
)
[]
error
{
...
...
@@ -29,6 +30,7 @@ func (c *AMIConfig) Prepare(t *packer.ConfigTemplate) []error {
templates
:=
map
[
string
]
*
string
{
"ami_name"
:
&
c
.
AMIName
,
"ami_description"
:
&
c
.
AMIDescription
,
"ami_visibility"
:
&
c
.
AMIVisibility
,
}
errs
:=
make
([]
error
,
0
)
...
...
builder/amazon/common/step_modify_ami_attributes.go
View file @
3589b0ba
...
...
@@ -13,6 +13,7 @@ type StepModifyAMIAttributes struct {
Groups
[]
string
ProductCodes
[]
string
Description
string
Visibility
string
}
func
(
s
*
StepModifyAMIAttributes
)
Run
(
state
multistep
.
StateBag
)
multistep
.
StepAction
{
...
...
@@ -26,6 +27,7 @@ func (s *StepModifyAMIAttributes) Run(state multistep.StateBag) multistep.StepAc
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
)
valid
=
valid
||
s
.
Visibility
==
"public"
if
!
valid
{
return
multistep
.
ActionContinue
...
...
@@ -59,6 +61,14 @@ 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
{
ui
.
Say
(
fmt
.
Sprintf
(
"Modifying attributes on AMI (%s)..."
,
ami
))
regionconn
:=
ec2
.
New
(
ec2conn
.
Auth
,
aws
.
Regions
[
region
])
...
...
builder/amazon/ebs/builder.go
View file @
3589b0ba
...
...
@@ -119,6 +119,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
Description
:
b
.
config
.
AMIDescription
,
Users
:
b
.
config
.
AMIUsers
,
Groups
:
b
.
config
.
AMIGroups
,
Visibility
:
b
.
config
.
AMIVisibility
,
},
&
awscommon
.
StepCreateTags
{
Tags
:
b
.
config
.
AMITags
,
...
...
builder/amazon/instance/builder.go
View file @
3589b0ba
...
...
@@ -225,6 +225,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
Users
:
b
.
config
.
AMIUsers
,
Groups
:
b
.
config
.
AMIGroups
,
ProductCodes
:
b
.
config
.
AMIProductCodes
,
Visibility
:
b
.
config
.
AMIVisibility
,
},
&
awscommon
.
StepCreateTags
{
Tags
:
b
.
config
.
AMITags
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment