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
fcb24f68
Commit
fcb24f68
authored
Aug 18, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
post-processor/vagrant: process output path properly
parent
153057a0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
68 deletions
+22
-68
CHANGELOG.md
CHANGELOG.md
+4
-0
post-processor/vagrant/aws.go
post-processor/vagrant/aws.go
+6
-15
post-processor/vagrant/util.go
post-processor/vagrant/util.go
+0
-23
post-processor/vagrant/virtualbox.go
post-processor/vagrant/virtualbox.go
+6
-15
post-processor/vagrant/vmware.go
post-processor/vagrant/vmware.go
+6
-15
No files found.
CHANGELOG.md
View file @
fcb24f68
...
...
@@ -9,6 +9,10 @@ IMPROVEMENTS:
*
builder/digitalocean: API requests will use HTTP proxy if specified
by environmental variables.
BUG FIXES:
*
post-processor/vagrant:
`output_path`
templates now work again.
## 0.3.2 (August 18, 2013)
FEATURES:
...
...
post-processor/vagrant/aws.go
View file @
fcb24f68
...
...
@@ -43,20 +43,8 @@ func (p *AWSBoxPostProcessor) Configure(raws ...interface{}) error {
// Accumulate any errors
errs
:=
common
.
CheckUnusedConfig
(
md
)
templates
:=
map
[
string
]
*
string
{
"output"
:
&
p
.
config
.
OutputPath
,
}
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
))
}
}
validates
:=
map
[
string
]
*
string
{
"output"
:
&
p
.
config
.
OutputPath
,
"vagrantfile_template"
:
&
p
.
config
.
VagrantfileTemplate
,
}
...
...
@@ -90,8 +78,11 @@ func (p *AWSBoxPostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact
}
// Compile the output path
outputPath
,
err
:=
ProcessOutputPath
(
p
.
config
.
OutputPath
,
p
.
config
.
PackerBuildName
,
"aws"
,
artifact
)
outputPath
,
err
:=
p
.
config
.
tpl
.
Process
(
p
.
config
.
OutputPath
,
&
OutputPathTemplate
{
ArtifactId
:
artifact
.
Id
(),
BuildName
:
p
.
config
.
PackerBuildName
,
Provider
:
"aws"
,
})
if
err
!=
nil
{
return
nil
,
false
,
err
}
...
...
post-processor/vagrant/util.go
View file @
fcb24f68
...
...
@@ -2,15 +2,12 @@ package vagrant
import
(
"archive/tar"
"bytes"
"compress/gzip"
"encoding/json"
"github.com/mitchellh/packer/packer"
"io"
"log"
"os"
"path/filepath"
"text/template"
)
// OutputPathTemplate is the structure that is availalable within the
...
...
@@ -108,26 +105,6 @@ func DirToBox(dst, dir string) error {
return
filepath
.
Walk
(
dir
,
tarWalk
)
}
// ProcessOutputPath takes an output path template and executes it,
// replacing variables with their respective values.
func
ProcessOutputPath
(
path
string
,
buildName
string
,
provider
string
,
artifact
packer
.
Artifact
)
(
string
,
error
)
{
var
buf
bytes
.
Buffer
tplData
:=
&
OutputPathTemplate
{
ArtifactId
:
artifact
.
Id
(),
BuildName
:
buildName
,
Provider
:
provider
,
}
t
,
err
:=
template
.
New
(
"output"
)
.
Parse
(
path
)
if
err
!=
nil
{
return
""
,
err
}
err
=
t
.
Execute
(
&
buf
,
tplData
)
return
buf
.
String
(),
err
}
// WriteMetadata writes the "metadata.json" file for a Vagrant box.
func
WriteMetadata
(
dir
string
,
contents
interface
{})
error
{
f
,
err
:=
os
.
Create
(
filepath
.
Join
(
dir
,
"metadata.json"
))
...
...
post-processor/vagrant/virtualbox.go
View file @
fcb24f68
...
...
@@ -45,20 +45,8 @@ func (p *VBoxBoxPostProcessor) Configure(raws ...interface{}) error {
// Accumulate any errors
errs
:=
common
.
CheckUnusedConfig
(
md
)
templates
:=
map
[
string
]
*
string
{
"output"
:
&
p
.
config
.
OutputPath
,
}
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
))
}
}
validates
:=
map
[
string
]
*
string
{
"output"
:
&
p
.
config
.
OutputPath
,
"vagrantfile_template"
:
&
p
.
config
.
VagrantfileTemplate
,
}
...
...
@@ -85,8 +73,11 @@ func (p *VBoxBoxPostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifac
}
// Compile the output path
outputPath
,
err
:=
ProcessOutputPath
(
p
.
config
.
OutputPath
,
p
.
config
.
PackerBuildName
,
"virtualbox"
,
artifact
)
outputPath
,
err
:=
p
.
config
.
tpl
.
Process
(
p
.
config
.
OutputPath
,
&
OutputPathTemplate
{
ArtifactId
:
artifact
.
Id
(),
BuildName
:
p
.
config
.
PackerBuildName
,
Provider
:
"virtualbox"
,
})
if
err
!=
nil
{
return
nil
,
false
,
err
}
...
...
post-processor/vagrant/vmware.go
View file @
fcb24f68
...
...
@@ -37,20 +37,8 @@ func (p *VMwareBoxPostProcessor) Configure(raws ...interface{}) error {
// Accumulate any errors
errs
:=
common
.
CheckUnusedConfig
(
md
)
templates
:=
map
[
string
]
*
string
{
"output"
:
&
p
.
config
.
OutputPath
,
}
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
))
}
}
validates
:=
map
[
string
]
*
string
{
"output"
:
&
p
.
config
.
OutputPath
,
"vagrantfile_template"
:
&
p
.
config
.
VagrantfileTemplate
,
}
...
...
@@ -70,8 +58,11 @@ func (p *VMwareBoxPostProcessor) Configure(raws ...interface{}) error {
func
(
p
*
VMwareBoxPostProcessor
)
PostProcess
(
ui
packer
.
Ui
,
artifact
packer
.
Artifact
)
(
packer
.
Artifact
,
bool
,
error
)
{
// Compile the output path
outputPath
,
err
:=
ProcessOutputPath
(
p
.
config
.
OutputPath
,
p
.
config
.
PackerBuildName
,
"vmware"
,
artifact
)
outputPath
,
err
:=
p
.
config
.
tpl
.
Process
(
p
.
config
.
OutputPath
,
&
OutputPathTemplate
{
ArtifactId
:
artifact
.
Id
(),
BuildName
:
p
.
config
.
PackerBuildName
,
Provider
:
"vmware"
,
})
if
err
!=
nil
{
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