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
fb5d1708
Commit
fb5d1708
authored
Dec 19, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
post-processor/vagrant: include files
parent
eaf76618
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
4 deletions
+19
-4
CHANGELOG.md
CHANGELOG.md
+2
-0
post-processor/vagrant/virtualbox.go
post-processor/vagrant/virtualbox.go
+17
-4
No files found.
CHANGELOG.md
View file @
fb5d1708
...
@@ -17,6 +17,8 @@ FEATURES:
...
@@ -17,6 +17,8 @@ FEATURES:
[GH-715]
[GH-715]
*
"description" field in templates: write a human-readable description
*
"description" field in templates: write a human-readable description
of what a template does. This will be shown in
`packer inspect`
.
of what a template does. This will be shown in
`packer inspect`
.
*
Vagrant post-processor now accepts a list of files to include in the
box.
IMPROVEMENTS:
IMPROVEMENTS:
...
...
post-processor/vagrant/virtualbox.go
View file @
fb5d1708
...
@@ -18,9 +18,10 @@ import (
...
@@ -18,9 +18,10 @@ import (
type
VBoxBoxConfig
struct
{
type
VBoxBoxConfig
struct
{
common
.
PackerConfig
`mapstructure:",squash"`
common
.
PackerConfig
`mapstructure:",squash"`
OutputPath
string
`mapstructure:"output"`
Include
[]
string
`mapstructure:"include"`
VagrantfileTemplate
string
`mapstructure:"vagrantfile_template"`
OutputPath
string
`mapstructure:"output"`
CompressionLevel
int
`mapstructure:"compression_level"`
VagrantfileTemplate
string
`mapstructure:"vagrantfile_template"`
CompressionLevel
int
`mapstructure:"compression_level"`
tpl
*
packer
.
ConfigTemplate
tpl
*
packer
.
ConfigTemplate
}
}
...
@@ -101,6 +102,16 @@ func (p *VBoxBoxPostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifac
...
@@ -101,6 +102,16 @@ func (p *VBoxBoxPostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifac
}
}
defer
os
.
RemoveAll
(
dir
)
defer
os
.
RemoveAll
(
dir
)
// Copy all of the includes files into the temporary directory
for
_
,
src
:=
range
p
.
config
.
Include
{
ui
.
Message
(
fmt
.
Sprintf
(
"Copying from include: %s"
,
src
))
dst
:=
filepath
.
Join
(
dir
,
filepath
.
Base
(
src
))
if
err
:=
CopyContents
(
dst
,
src
);
err
!=
nil
{
err
=
fmt
.
Errorf
(
"Error copying include file: %s
\n\n
%s"
,
src
,
err
)
return
nil
,
false
,
err
}
}
// Copy all of the original contents into the temporary directory
// Copy all of the original contents into the temporary directory
for
_
,
path
:=
range
artifact
.
Files
()
{
for
_
,
path
:=
range
artifact
.
Files
()
{
...
@@ -112,7 +123,7 @@ func (p *VBoxBoxPostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifac
...
@@ -112,7 +123,7 @@ func (p *VBoxBoxPostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifac
return
nil
,
false
,
err
return
nil
,
false
,
err
}
}
}
else
{
}
else
{
ui
.
Message
(
fmt
.
Sprintf
(
"Copying: %s"
,
path
))
ui
.
Message
(
fmt
.
Sprintf
(
"Copying
from artifact
: %s"
,
path
))
dstPath
:=
filepath
.
Join
(
dir
,
filepath
.
Base
(
path
))
dstPath
:=
filepath
.
Join
(
dir
,
filepath
.
Base
(
path
))
if
err
:=
CopyContents
(
dstPath
,
path
);
err
!=
nil
{
if
err
:=
CopyContents
(
dstPath
,
path
);
err
!=
nil
{
return
nil
,
false
,
err
return
nil
,
false
,
err
...
@@ -136,6 +147,8 @@ func (p *VBoxBoxPostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifac
...
@@ -136,6 +147,8 @@ func (p *VBoxBoxPostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifac
vagrantfileContents
:=
defaultVBoxVagrantfile
vagrantfileContents
:=
defaultVBoxVagrantfile
if
p
.
config
.
VagrantfileTemplate
!=
""
{
if
p
.
config
.
VagrantfileTemplate
!=
""
{
ui
.
Message
(
fmt
.
Sprintf
(
"Using Vagrantfile template: %s"
,
p
.
config
.
VagrantfileTemplate
))
f
,
err
:=
os
.
Open
(
p
.
config
.
VagrantfileTemplate
)
f
,
err
:=
os
.
Open
(
p
.
config
.
VagrantfileTemplate
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
false
,
err
return
nil
,
false
,
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