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
b49fe497
Commit
b49fe497
authored
Aug 15, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/amazon: modifying more than one AMI attribute type works
parent
9e01b5a4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
11 deletions
+37
-11
CHANGELOG.md
CHANGELOG.md
+2
-0
builder/amazon/common/step_modify_ami_attributes.go
builder/amazon/common/step_modify_ami_attributes.go
+35
-11
No files found.
CHANGELOG.md
View file @
b49fe497
...
...
@@ -29,6 +29,8 @@ BUG FIXES:
*
windows: file URLs are easier to get right as Packer
has better parsing and error handling for Windows file paths. [GH-284]
*
builder/amazon/all: Modifying more than one AMI attribute type no longer
crashes.
*
builder/amazon-instance: send IAM instance profile data. [GH-294]
*
builder/virtualbox: dowload progress won't be shown until download
actually starts. [GH-288]
...
...
builder/amazon/common/step_modify_ami_attributes.go
View file @
b49fe497
...
...
@@ -31,21 +31,45 @@ func (s *StepModifyAMIAttributes) Run(state map[string]interface{}) multistep.St
return
multistep
.
ActionContinue
}
options
:=
&
ec2
.
ModifyImageAttribute
{
// Construct the modify image attribute requests we're going to make.
// We need to make each separately since the EC2 API only allows changing
// one type at a kind currently.
options
:=
make
(
map
[
string
]
*
ec2
.
ModifyImageAttribute
)
if
s
.
Description
!=
""
{
options
[
"description"
]
=
&
ec2
.
ModifyImageAttribute
{
Description
:
s
.
Description
,
AddUsers
:
s
.
Users
,
}
}
if
len
(
s
.
Groups
)
>
0
{
options
[
"groups"
]
=
&
ec2
.
ModifyImageAttribute
{
AddGroups
:
s
.
Groups
,
}
}
if
len
(
s
.
Users
)
>
0
{
options
[
"users"
]
=
&
ec2
.
ModifyImageAttribute
{
AddUsers
:
s
.
Users
,
}
}
if
len
(
s
.
ProductCodes
)
>
0
{
options
[
"product codes"
]
=
&
ec2
.
ModifyImageAttribute
{
ProductCodes
:
s
.
ProductCodes
,
}
}
ui
.
Say
(
"Modifying AMI attributes..."
)
_
,
err
:=
ec2conn
.
ModifyImageAttribute
(
ami
,
options
)
for
name
,
opts
:=
range
options
{
ui
.
Message
(
fmt
.
Sprintf
(
"Modifying: %s"
,
name
))
_
,
err
:=
ec2conn
.
ModifyImageAttribute
(
ami
,
opts
)
if
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"Error modify AMI attributes: %s"
,
err
)
state
[
"error"
]
=
err
ui
.
Error
(
err
.
Error
())
return
multistep
.
ActionHalt
}
}
return
multistep
.
ActionContinue
}
...
...
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