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
98a52c29
Commit
98a52c29
authored
Oct 28, 2014
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1597 from petrhosek/enable-custom-vagrant-providers
Extract Vagrant provider processing logic to a method
parents
af4ff240
3992f447
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
14 deletions
+18
-14
post-processor/vagrant/post-processor.go
post-processor/vagrant/post-processor.go
+18
-14
No files found.
post-processor/vagrant/post-processor.go
View file @
98a52c29
...
@@ -65,20 +65,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error {
...
@@ -65,20 +65,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error {
return
nil
return
nil
}
}
func
(
p
*
PostProcessor
)
PostProcess
(
ui
packer
.
Ui
,
artifact
packer
.
Artifact
)
(
packer
.
Artifact
,
bool
,
error
)
{
func
(
p
*
PostProcessor
)
PostProcessProvider
(
name
string
,
provider
Provider
,
ui
packer
.
Ui
,
artifact
packer
.
Artifact
)
(
packer
.
Artifact
,
bool
,
error
)
{
name
,
ok
:=
builtins
[
artifact
.
BuilderId
()]
if
!
ok
{
return
nil
,
false
,
fmt
.
Errorf
(
"Unknown artifact type, can't build box: %s"
,
artifact
.
BuilderId
())
}
provider
:=
providerForName
(
name
)
if
provider
==
nil
{
// This shouldn't happen since we hard code all of these ourselves
panic
(
fmt
.
Sprintf
(
"bad provider name: %s"
,
name
))
}
config
:=
p
.
configs
[
""
]
config
:=
p
.
configs
[
""
]
if
specificConfig
,
ok
:=
p
.
configs
[
name
];
ok
{
if
specificConfig
,
ok
:=
p
.
configs
[
name
];
ok
{
config
=
specificConfig
config
=
specificConfig
...
@@ -164,6 +151,23 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
...
@@ -164,6 +151,23 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
return
NewArtifact
(
name
,
outputPath
),
provider
.
KeepInputArtifact
(),
nil
return
NewArtifact
(
name
,
outputPath
),
provider
.
KeepInputArtifact
(),
nil
}
}
func
(
p
*
PostProcessor
)
PostProcess
(
ui
packer
.
Ui
,
artifact
packer
.
Artifact
)
(
packer
.
Artifact
,
bool
,
error
)
{
name
,
ok
:=
builtins
[
artifact
.
BuilderId
()]
if
!
ok
{
return
nil
,
false
,
fmt
.
Errorf
(
"Unknown artifact type, can't build box: %s"
,
artifact
.
BuilderId
())
}
provider
:=
providerForName
(
name
)
if
provider
==
nil
{
// This shouldn't happen since we hard code all of these ourselves
panic
(
fmt
.
Sprintf
(
"bad provider name: %s"
,
name
))
}
return
p
.
PostProcessProvider
(
name
,
provider
,
ui
,
artifact
)
}
func
(
p
*
PostProcessor
)
configureSingle
(
config
*
Config
,
raws
...
interface
{})
error
{
func
(
p
*
PostProcessor
)
configureSingle
(
config
*
Config
,
raws
...
interface
{})
error
{
md
,
err
:=
common
.
DecodeConfig
(
config
,
raws
...
)
md
,
err
:=
common
.
DecodeConfig
(
config
,
raws
...
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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