2014-03-12 09:12:20 -04:00
|
|
|
package common
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"github.com/mitchellh/packer/packer"
|
|
|
|
)
|
|
|
|
|
|
|
|
type ExportOpts struct {
|
2014-03-13 23:12:50 -04:00
|
|
|
ExportOpts []string `mapstructure:"export_opts"`
|
2014-03-12 09:12:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c *ExportOpts) Prepare(t *packer.ConfigTemplate) []error {
|
2014-03-13 23:12:50 -04:00
|
|
|
if c.ExportOpts == nil {
|
|
|
|
c.ExportOpts = make([]string, 0)
|
2014-03-12 09:12:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
errs := make([]error, 0)
|
2014-03-14 12:22:32 -04:00
|
|
|
for i, str := range c.ExportOpts {
|
2014-03-12 09:12:20 -04:00
|
|
|
var err error
|
2014-03-14 12:22:32 -04:00
|
|
|
c.ExportOpts[i], err = t.Process(str, nil)
|
2014-03-12 09:12:20 -04:00
|
|
|
if err != nil {
|
2014-03-13 23:12:50 -04:00
|
|
|
errs = append(errs, fmt.Errorf("Error processing %s: %s", "export_opts", err))
|
2014-03-12 09:12:20 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return errs
|
|
|
|
}
|