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
31bdb485
Commit
31bdb485
authored
May 27, 2015
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/null: interpolations
parent
5aa30caa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
27 deletions
+11
-27
builder/null/config.go
builder/null/config.go
+11
-27
No files found.
builder/null/config.go
View file @
31bdb485
...
@@ -3,7 +3,9 @@ package null
...
@@ -3,7 +3,9 @@ package null
import
(
import
(
"fmt"
"fmt"
"github.com/mitchellh/packer/common"
"github.com/mitchellh/packer/common"
"github.com/mitchellh/packer/helper/config"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/template/interpolate"
)
)
type
Config
struct
{
type
Config
struct
{
...
@@ -14,46 +16,28 @@ type Config struct {
...
@@ -14,46 +16,28 @@ type Config struct {
SSHUsername
string
`mapstructure:"ssh_username"`
SSHUsername
string
`mapstructure:"ssh_username"`
SSHPassword
string
`mapstructure:"ssh_password"`
SSHPassword
string
`mapstructure:"ssh_password"`
SSHPrivateKeyFile
string
`mapstructure:"ssh_private_key_file"`
SSHPrivateKeyFile
string
`mapstructure:"ssh_private_key_file"`
tpl
*
packer
.
ConfigTemplate
}
}
func
NewConfig
(
raws
...
interface
{})
(
*
Config
,
[]
string
,
error
)
{
func
NewConfig
(
raws
...
interface
{})
(
*
Config
,
[]
string
,
error
)
{
c
:=
new
(
Config
)
c
:=
new
(
Config
)
md
,
err
:=
common
.
DecodeConfig
(
c
,
raws
...
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
c
.
tpl
,
err
=
packer
.
NewConfigTemplate
()
err
:=
config
.
Decode
(
&
c
,
&
config
.
DecodeOpts
{
Interpolate
:
true
,
InterpolateFilter
:
&
interpolate
.
RenderFilter
{
Exclude
:
[]
string
{
"run_command"
,
},
},
},
raws
...
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
nil
,
err
}
}
c
.
tpl
.
UserVars
=
c
.
PackerUserVars
if
c
.
Port
==
0
{
if
c
.
Port
==
0
{
c
.
Port
=
22
c
.
Port
=
22
}
}
errs
:=
common
.
CheckUnusedConfig
(
md
)
var
errs
*
packer
.
MultiError
templates
:=
map
[
string
]
*
string
{
"host"
:
&
c
.
Host
,
"ssh_username"
:
&
c
.
SSHUsername
,
"ssh_password"
:
&
c
.
SSHPassword
,
"ssh_private_key_file"
:
&
c
.
SSHPrivateKeyFile
,
}
for
n
,
ptr
:=
range
templates
{
var
err
error
*
ptr
,
err
=
c
.
tpl
.
Process
(
*
ptr
,
nil
)
if
err
!=
nil
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
fmt
.
Errorf
(
"Error processing %s: %s"
,
n
,
err
))
}
}
if
c
.
Host
==
""
{
if
c
.
Host
==
""
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
errs
=
packer
.
MultiErrorAppend
(
errs
,
fmt
.
Errorf
(
"host must be specified"
))
fmt
.
Errorf
(
"host must be specified"
))
...
...
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