github.com/askholme/packer@v0.7.2-0.20140924152349-70d9566a6852/builder/virtualbox/common/export_opts.go (about)

     1  package common
     2  
     3  import (
     4  	"fmt"
     5  	"github.com/mitchellh/packer/packer"
     6  )
     7  
     8  type ExportOpts struct {
     9  	ExportOpts []string `mapstructure:"export_opts"`
    10  }
    11  
    12  func (c *ExportOpts) Prepare(t *packer.ConfigTemplate) []error {
    13  	if c.ExportOpts == nil {
    14  		c.ExportOpts = make([]string, 0)
    15  	}
    16  
    17  	errs := make([]error, 0)
    18  	for i, str := range c.ExportOpts {
    19  		var err error
    20  		c.ExportOpts[i], err = t.Process(str, nil)
    21  		if err != nil {
    22  			errs = append(errs, fmt.Errorf("Error processing %s: %s", "export_opts", err))
    23  		}
    24  	}
    25  
    26  	return errs
    27  }