Commit 8e46cd5c authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

post-processor/vagrant: provider-specific config works

parent f035b7a0
...@@ -41,13 +41,12 @@ func (p *PostProcessor) Configure(raw interface{}) error { ...@@ -41,13 +41,12 @@ func (p *PostProcessor) Configure(raw interface{}) error {
return fmt.Errorf("output invalid template: %s", err) return fmt.Errorf("output invalid template: %s", err)
} }
/* var mapConfig map[string]interface{}
TODO(mitchellh): We need a way to get the keys... if err := mapstructure.Decode(raw, &mapConfig); err != nil {
mapConfig, ok := raw.(map[string]interface{}) return err
if !ok {
panic("Raw configuration not a map")
} }
p.premade = make(map[string]packer.PostProcessor)
errors := make([]error, 0) errors := make([]error, 0)
for k, raw := range mapConfig { for k, raw := range mapConfig {
pp := keyToPostProcessor(k) pp := keyToPostProcessor(k)
...@@ -65,7 +64,6 @@ func (p *PostProcessor) Configure(raw interface{}) error { ...@@ -65,7 +64,6 @@ func (p *PostProcessor) Configure(raw interface{}) error {
if len(errors) > 0 { if len(errors) > 0 {
return &packer.MultiError{errors} return &packer.MultiError{errors}
} }
*/
return nil return nil
} }
......
...@@ -35,3 +35,15 @@ func TestBuilderPrepare_OutputPath(t *testing.T) { ...@@ -35,3 +35,15 @@ func TestBuilderPrepare_OutputPath(t *testing.T) {
t.Fatal("should have error") t.Fatal("should have error")
} }
} }
func TestBuilderPrepare_PPConfig(t *testing.T) {
var p PostProcessor
// Default
c := testConfig()
c["aws"] = map[string]interface{}{}
err := p.Configure(c)
if err != nil {
t.Fatalf("err: %s", err)
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment