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
a17c9390
Commit
a17c9390
authored
Aug 13, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
packer: export template RawConfig
parent
f78d7708
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
18 deletions
+18
-18
packer/template.go
packer/template.go
+9
-9
packer/template_test.go
packer/template_test.go
+9
-9
No files found.
packer/template.go
View file @
a17c9390
...
...
@@ -38,7 +38,7 @@ type RawBuilderConfig struct {
Name
string
Type
string
r
awConfig
interface
{}
R
awConfig
interface
{}
}
// RawPostProcessorConfig represents a raw, unprocessed post-processor
...
...
@@ -47,7 +47,7 @@ type RawBuilderConfig struct {
type
RawPostProcessorConfig
struct
{
Type
string
KeepInputArtifact
bool
`mapstructure:"keep_input_artifact"`
r
awConfig
interface
{}
R
awConfig
interface
{}
}
// RawProvisionerConfig represents a raw, unprocessed provisioner configuration.
...
...
@@ -57,7 +57,7 @@ type RawProvisionerConfig struct {
Type
string
Override
map
[
string
]
interface
{}
r
awConfig
interface
{}
R
awConfig
interface
{}
}
// ParseTemplate takes a byte slice and parses a Template from it, returning
...
...
@@ -150,7 +150,7 @@ func ParseTemplate(data []byte) (t *Template, err error) {
// itself doesn't know about, and it will cause a validation error.
delete
(
v
,
"name"
)
raw
.
r
awConfig
=
v
raw
.
R
awConfig
=
v
t
.
Builders
[
raw
.
Name
]
=
raw
}
...
...
@@ -186,7 +186,7 @@ func ParseTemplate(data []byte) (t *Template, err error) {
continue
}
config
.
r
awConfig
=
pp
config
.
R
awConfig
=
pp
}
}
...
...
@@ -215,7 +215,7 @@ func ParseTemplate(data []byte) (t *Template, err error) {
// actively reject them as invalid configuration.
delete
(
v
,
"override"
)
raw
.
r
awConfig
=
v
raw
.
R
awConfig
=
v
}
if
len
(
t
.
Builders
)
==
0
{
...
...
@@ -365,7 +365,7 @@ func (t *Template) Build(name string, components *ComponentFinder) (b Build, err
current
[
i
]
=
coreBuildPostProcessor
{
processor
:
pp
,
processorType
:
rawPP
.
Type
,
config
:
rawPP
.
r
awConfig
,
config
:
rawPP
.
R
awConfig
,
keepInputArtifact
:
rawPP
.
KeepInputArtifact
,
}
}
...
...
@@ -388,7 +388,7 @@ func (t *Template) Build(name string, components *ComponentFinder) (b Build, err
}
configs
:=
make
([]
interface
{},
1
,
2
)
configs
[
0
]
=
rawProvisioner
.
r
awConfig
configs
[
0
]
=
rawProvisioner
.
R
awConfig
if
rawProvisioner
.
Override
!=
nil
{
if
override
,
ok
:=
rawProvisioner
.
Override
[
name
];
ok
{
...
...
@@ -403,7 +403,7 @@ func (t *Template) Build(name string, components *ComponentFinder) (b Build, err
b
=
&
coreBuild
{
name
:
name
,
builder
:
builder
,
builderConfig
:
builderConfig
.
r
awConfig
,
builderConfig
:
builderConfig
.
R
awConfig
,
builderType
:
builderConfig
.
Type
,
hooks
:
hooks
,
postProcessors
:
postProcessors
,
...
...
packer/template_test.go
View file @
a17c9390
...
...
@@ -165,8 +165,8 @@ func TestParseTemplate_BuilderWithName(t *testing.T) {
assert
.
True
(
ok
,
"should have bob builder"
)
assert
.
Equal
(
builder
.
Type
,
"amazon-ebs"
,
"builder should be amazon-ebs"
)
rawConfig
:=
builder
.
r
awConfig
if
r
awConfig
==
nil
{
RawConfig
:=
builder
.
R
awConfig
if
R
awConfig
==
nil
{
t
.
Fatal
(
"missing builder raw config"
)
}
...
...
@@ -174,8 +174,8 @@ func TestParseTemplate_BuilderWithName(t *testing.T) {
"type"
:
"amazon-ebs"
,
}
if
!
reflect
.
DeepEqual
(
r
awConfig
,
expected
)
{
t
.
Fatalf
(
"bad raw: %#v"
,
r
awConfig
)
if
!
reflect
.
DeepEqual
(
R
awConfig
,
expected
)
{
t
.
Fatalf
(
"bad raw: %#v"
,
R
awConfig
)
}
}
...
...
@@ -333,7 +333,7 @@ func TestParseTemplate_Provisioners(t *testing.T) {
assert
.
NotNil
(
result
,
"template should not be nil"
)
assert
.
Length
(
result
.
Provisioners
,
1
,
"should have one provisioner"
)
assert
.
Equal
(
result
.
Provisioners
[
0
]
.
Type
,
"shell"
,
"provisioner should be shell"
)
assert
.
NotNil
(
result
.
Provisioners
[
0
]
.
r
awConfig
,
"should have raw config"
)
assert
.
NotNil
(
result
.
Provisioners
[
0
]
.
R
awConfig
,
"should have raw config"
)
}
func
TestParseTemplate_Variables
(
t
*
testing
.
T
)
{
...
...
@@ -631,8 +631,8 @@ func TestTemplate_Build_ProvisionerOverride(t *testing.T) {
t
.
Fatalf
(
"err: %s"
,
err
)
}
rawConfig
:=
template
.
Provisioners
[
0
]
.
r
awConfig
if
r
awConfig
==
nil
{
RawConfig
:=
template
.
Provisioners
[
0
]
.
R
awConfig
if
R
awConfig
==
nil
{
t
.
Fatal
(
"missing provisioner raw config"
)
}
...
...
@@ -640,8 +640,8 @@ func TestTemplate_Build_ProvisionerOverride(t *testing.T) {
"type"
:
"test-prov"
,
}
if
!
reflect
.
DeepEqual
(
r
awConfig
,
expected
)
{
t
.
Fatalf
(
"bad raw: %#v"
,
r
awConfig
)
if
!
reflect
.
DeepEqual
(
R
awConfig
,
expected
)
{
t
.
Fatalf
(
"bad raw: %#v"
,
R
awConfig
)
}
builder
:=
testBuilder
()
...
...
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