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
f78d7708
Commit
f78d7708
authored
Aug 13, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
packer: Export the raw template config structs
parent
da6bc82d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
packer/template.go
packer/template.go
+14
-14
No files found.
packer/template.go
View file @
f78d7708
...
...
@@ -24,36 +24,36 @@ type rawTemplate struct {
// completed form it can be without additional processing by the caller.
type
Template
struct
{
Variables
map
[
string
]
string
Builders
map
[
string
]
r
awBuilderConfig
Builders
map
[
string
]
R
awBuilderConfig
Hooks
map
[
string
][]
string
PostProcessors
[][]
r
awPostProcessorConfig
Provisioners
[]
r
awProvisionerConfig
PostProcessors
[][]
R
awPostProcessorConfig
Provisioners
[]
R
awProvisionerConfig
}
// The
r
awBuilderConfig struct represents a raw, unprocessed builder
// The
R
awBuilderConfig struct represents a raw, unprocessed builder
// configuration. It contains the name of the builder as well as the
// raw configuration. If requested, this is used to compile into a full
// builder configuration at some point.
type
r
awBuilderConfig
struct
{
type
R
awBuilderConfig
struct
{
Name
string
Type
string
rawConfig
interface
{}
}
//
r
awPostProcessorConfig represents a raw, unprocessed post-processor
//
R
awPostProcessorConfig represents a raw, unprocessed post-processor
// configuration. It contains the type of the post processor as well as the
// raw configuration that is handed to the post-processor for it to process.
type
r
awPostProcessorConfig
struct
{
type
R
awPostProcessorConfig
struct
{
Type
string
KeepInputArtifact
bool
`mapstructure:"keep_input_artifact"`
rawConfig
interface
{}
}
//
r
awProvisionerConfig represents a raw, unprocessed provisioner configuration.
//
R
awProvisionerConfig represents a raw, unprocessed provisioner configuration.
// It contains the type of the provisioner as well as the raw configuration
// that is handed to the provisioner for it to process.
type
r
awProvisionerConfig
struct
{
type
R
awProvisionerConfig
struct
{
Type
string
Override
map
[
string
]
interface
{}
...
...
@@ -103,10 +103,10 @@ func ParseTemplate(data []byte) (t *Template, err error) {
t
=
&
Template
{}
t
.
Variables
=
make
(
map
[
string
]
string
)
t
.
Builders
=
make
(
map
[
string
]
r
awBuilderConfig
)
t
.
Builders
=
make
(
map
[
string
]
R
awBuilderConfig
)
t
.
Hooks
=
rawTpl
.
Hooks
t
.
PostProcessors
=
make
([][]
r
awPostProcessorConfig
,
len
(
rawTpl
.
PostProcessors
))
t
.
Provisioners
=
make
([]
r
awProvisionerConfig
,
len
(
rawTpl
.
Provisioners
))
t
.
PostProcessors
=
make
([][]
R
awPostProcessorConfig
,
len
(
rawTpl
.
PostProcessors
))
t
.
Provisioners
=
make
([]
R
awProvisionerConfig
,
len
(
rawTpl
.
Provisioners
))
// Gather all the variables
for
k
,
v
:=
range
rawTpl
.
Variables
{
...
...
@@ -115,7 +115,7 @@ func ParseTemplate(data []byte) (t *Template, err error) {
// Gather all the builders
for
i
,
v
:=
range
rawTpl
.
Builders
{
var
raw
r
awBuilderConfig
var
raw
R
awBuilderConfig
if
err
:=
mapstructure
.
Decode
(
v
,
&
raw
);
err
!=
nil
{
if
merr
,
ok
:=
err
.
(
*
mapstructure
.
Error
);
ok
{
for
_
,
err
:=
range
merr
.
Errors
{
...
...
@@ -165,7 +165,7 @@ func ParseTemplate(data []byte) (t *Template, err error) {
continue
}
t
.
PostProcessors
[
i
]
=
make
([]
r
awPostProcessorConfig
,
len
(
rawPP
))
t
.
PostProcessors
[
i
]
=
make
([]
R
awPostProcessorConfig
,
len
(
rawPP
))
configs
:=
t
.
PostProcessors
[
i
]
for
j
,
pp
:=
range
rawPP
{
config
:=
&
configs
[
j
]
...
...
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