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

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