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
7ab45f85
Commit
7ab45f85
authored
Aug 08, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/amazon/ebs: process templates for config
parent
e6b7a478
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
7 deletions
+30
-7
builder/amazon/ebs/builder.go
builder/amazon/ebs/builder.go
+30
-7
No files found.
builder/amazon/ebs/builder.go
View file @
7ab45f85
...
@@ -14,7 +14,6 @@ import (
...
@@ -14,7 +14,6 @@ import (
"github.com/mitchellh/packer/common"
"github.com/mitchellh/packer/common"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/packer"
"log"
"log"
"text/template"
)
)
// The unique ID for this builder
// The unique ID for this builder
...
@@ -30,6 +29,8 @@ type config struct {
...
@@ -30,6 +29,8 @@ type config struct {
// Tags for the AMI
// Tags for the AMI
Tags
map
[
string
]
string
Tags
map
[
string
]
string
tpl
*
common
.
Template
}
}
type
Builder
struct
{
type
Builder
struct
{
...
@@ -43,23 +44,45 @@ func (b *Builder) Prepare(raws ...interface{}) error {
...
@@ -43,23 +44,45 @@ func (b *Builder) Prepare(raws ...interface{}) error {
return
err
return
err
}
}
b
.
config
.
tpl
,
err
=
common
.
NewTemplate
()
if
err
!=
nil
{
return
err
}
// Accumulate any errors
// Accumulate any errors
errs
:=
common
.
CheckUnusedConfig
(
md
)
errs
:=
common
.
CheckUnusedConfig
(
md
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
AccessConfig
.
Prepare
()
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
AccessConfig
.
Prepare
(
b
.
config
.
tpl
)
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
RunConfig
.
Prepare
()
...
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
b
.
config
.
RunConfig
.
Prepare
(
b
.
config
.
tpl
)
...
)
// Accumulate any errors
// Accumulate any errors
if
b
.
config
.
AMIName
==
""
{
if
b
.
config
.
AMIName
==
""
{
errs
=
packer
.
MultiErrorAppend
(
errs
=
packer
.
MultiErrorAppend
(
errs
,
errors
.
New
(
"ami_name must be specified"
))
errs
,
errors
.
New
(
"ami_name must be specified"
))
}
else
{
}
else
if
b
.
config
.
AMIName
,
err
=
b
.
config
.
tpl
.
Process
(
b
.
config
.
AMIName
,
nil
);
err
!=
nil
{
_
,
err
=
template
.
New
(
"ami"
)
.
Parse
(
b
.
config
.
AMIName
)
errs
=
packer
.
MultiErrorAppend
(
errs
,
err
)
}
newTags
:=
make
(
map
[
string
]
string
)
for
k
,
v
:=
range
b
.
config
.
Tags
{
k
,
err
=
b
.
config
.
tpl
.
Process
(
k
,
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
errs
=
packer
.
MultiErrorAppend
(
errs
=
packer
.
MultiErrorAppend
(
errs
,
errs
,
fmt
.
Errorf
(
"Failed parsing ami_name: %s"
,
err
))
fmt
.
Errorf
(
"Error processing tag key %s: %s"
,
k
,
err
))
continue
}
}
v
,
err
=
b
.
config
.
tpl
.
Process
(
v
,
nil
)
if
err
!=
nil
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
fmt
.
Errorf
(
"Error processing tag value '%s': %s"
,
v
,
err
))
continue
}
}
newTags
[
k
]
=
v
}
b
.
config
.
Tags
=
newTags
if
errs
!=
nil
&&
len
(
errs
.
Errors
)
>
0
{
if
errs
!=
nil
&&
len
(
errs
.
Errors
)
>
0
{
return
errs
return
errs
}
}
...
...
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