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

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