2019-05-31 08:27:41 -04:00
|
|
|
//go:generate struct-markdown
|
|
|
|
|
2013-12-21 20:38:06 -05:00
|
|
|
package common
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2015-05-27 17:01:08 -04:00
|
|
|
|
2017-04-04 16:39:01 -04:00
|
|
|
"github.com/hashicorp/packer/common"
|
|
|
|
"github.com/hashicorp/packer/template/interpolate"
|
2013-12-21 20:38:06 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
type OutputConfig struct {
|
2019-05-28 11:50:58 -04:00
|
|
|
// This is the path to the directory where the
|
2019-06-06 10:29:25 -04:00
|
|
|
// resulting virtual machine will be created. This may be relative or absolute.
|
|
|
|
// If relative, the path is relative to the working directory when packer
|
|
|
|
// is executed. This directory must not exist or be empty prior to running
|
|
|
|
// the builder. By default this is output-BUILDNAME where "BUILDNAME" is the
|
|
|
|
// name of the build.
|
2019-05-28 11:50:58 -04:00
|
|
|
OutputDir string `mapstructure:"output_directory" required:"false"`
|
2020-05-05 19:09:05 -04:00
|
|
|
// This is the base name of the file (excluding the file extension) where
|
|
|
|
// the resulting virtual machine will be created. By default this is the
|
|
|
|
// `vm_name`.
|
|
|
|
OutputFilename string `mapstructure:"output_filename" required:"false"`
|
2013-12-21 20:38:06 -05:00
|
|
|
}
|
|
|
|
|
2015-05-27 17:01:08 -04:00
|
|
|
func (c *OutputConfig) Prepare(ctx *interpolate.Context, pc *common.PackerConfig) []error {
|
2013-12-21 20:38:06 -05:00
|
|
|
if c.OutputDir == "" {
|
|
|
|
c.OutputDir = fmt.Sprintf("output-%s", pc.PackerBuildName)
|
|
|
|
}
|
|
|
|
|
2015-06-13 16:58:37 -04:00
|
|
|
return nil
|
2013-12-21 20:38:06 -05:00
|
|
|
}
|