Merge pull request #1597 from petrhosek/enable-custom-vagrant-providers
Extract Vagrant provider processing logic to a method
This commit is contained in:
commit
98a52c296c
|
@ -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
|
||||||
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 {
|
||||||
|
|
Loading…
Reference in New Issue