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
8bffb4f1
Commit
8bffb4f1
authored
Aug 03, 2013
by
James Massara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved Tags configuration out of common and into ebs.
parent
9d0fdace
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
1 deletion
+29
-1
builder/amazon/ebs/builder.go
builder/amazon/ebs/builder.go
+29
-1
No files found.
builder/amazon/ebs/builder.go
View file @
8bffb4f1
...
@@ -27,6 +27,12 @@ type config struct {
...
@@ -27,6 +27,12 @@ type config struct {
// Configuration of the resulting AMI
// Configuration of the resulting AMI
AMIName
string
`mapstructure:"ami_name"`
AMIName
string
`mapstructure:"ami_name"`
// Tags for the AMI
Tags
[]
map
[
string
]
string
// Unexported fields that are calculated from others
ec2Tags
[]
ec2
.
Tag
}
}
type
Builder
struct
{
type
Builder
struct
{
...
@@ -57,6 +63,28 @@ func (b *Builder) Prepare(raws ...interface{}) error {
...
@@ -57,6 +63,28 @@ func (b *Builder) Prepare(raws ...interface{}) error {
}
}
}
}
// Accumulate any errors
if
b
.
config
.
Tags
!=
nil
{
var
ec2Tags
[]
ec2
.
Tag
for
_
,
tag
:=
range
b
.
config
.
Tags
{
if
_
,
ok
:=
tag
[
"key"
];
!
ok
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
fmt
.
Errorf
(
"Unknown tag configuration, expecting 'key'"
))
continue
}
if
_
,
ok
:=
tag
[
"value"
];
!
ok
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
fmt
.
Errorf
(
"Unknown tag configuration, expecting 'value'"
))
continue
}
ec2Tags
=
append
(
ec2Tags
,
ec2
.
Tag
{
Key
:
tag
[
"key"
],
Value
:
tag
[
"value"
],
})
}
b
.
config
.
ec2Tags
=
ec2Tags
}
if
errs
!=
nil
&&
len
(
errs
.
Errors
)
>
0
{
if
errs
!=
nil
&&
len
(
errs
.
Errors
)
>
0
{
return
errs
return
errs
}
}
...
@@ -108,7 +136,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
...
@@ -108,7 +136,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
&
common
.
StepProvision
{},
&
common
.
StepProvision
{},
&
stepStopInstance
{},
&
stepStopInstance
{},
&
stepCreateAMI
{
&
stepCreateAMI
{
Tags
:
b
.
config
.
Tags
,
Tags
:
b
.
config
.
ec2
Tags
,
},
},
}
}
...
...
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