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
bf67c6c3
Commit
bf67c6c3
authored
Aug 08, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
provisioner/file: use the template processing stuff
parent
c0235886
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
provisioner/file/provisioner.go
provisioner/file/provisioner.go
+21
-0
No files found.
provisioner/file/provisioner.go
View file @
bf67c6c3
...
...
@@ -14,6 +14,8 @@ type config struct {
// The remote path where the local file will be uploaded to.
Destination
string
tpl
*
common
.
Template
}
type
Provisioner
struct
{
...
...
@@ -26,9 +28,28 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
return
err
}
p
.
config
.
tpl
,
err
=
common
.
NewTemplate
()
if
err
!=
nil
{
return
err
}
// Accumulate any errors
errs
:=
common
.
CheckUnusedConfig
(
md
)
templates
:=
map
[
string
]
*
string
{
"source"
:
&
p
.
config
.
Source
,
"destination"
:
&
p
.
config
.
Destination
,
}
for
n
,
ptr
:=
range
templates
{
var
err
error
*
ptr
,
err
=
p
.
config
.
tpl
.
Process
(
*
ptr
,
nil
)
if
err
!=
nil
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
fmt
.
Errorf
(
"Error processing %s: %s"
,
n
,
err
))
}
}
if
_
,
err
:=
os
.
Stat
(
p
.
config
.
Source
);
err
!=
nil
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
fmt
.
Errorf
(
"Bad source '%s': %s"
,
p
.
config
.
Source
,
err
))
...
...
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