*: switch to packer ConfigTemplate
This commit is contained in:
parent
349a83d6d6
commit
64d87bfaf3
|
@ -34,7 +34,7 @@ type Config struct {
|
||||||
SourceAmi string `mapstructure:"source_ami"`
|
SourceAmi string `mapstructure:"source_ami"`
|
||||||
UnmountCommand string `mapstructure:"unmount_command"`
|
UnmountCommand string `mapstructure:"unmount_command"`
|
||||||
|
|
||||||
tpl *common.Template
|
tpl *packer.ConfigTemplate
|
||||||
}
|
}
|
||||||
|
|
||||||
type Builder struct {
|
type Builder struct {
|
||||||
|
@ -48,7 +48,7 @@ func (b *Builder) Prepare(raws ...interface{}) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
b.config.tpl, err = common.NewTemplate()
|
b.config.tpl, err = packer.NewConfigTemplate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package common
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/mitchellh/goamz/aws"
|
"github.com/mitchellh/goamz/aws"
|
||||||
"github.com/mitchellh/packer/common"
|
"github.com/mitchellh/packer/packer"
|
||||||
"strings"
|
"strings"
|
||||||
"unicode"
|
"unicode"
|
||||||
)
|
)
|
||||||
|
@ -37,10 +37,10 @@ func (c *AccessConfig) Region() (aws.Region, error) {
|
||||||
return aws.Regions[region], nil
|
return aws.Regions[region], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *AccessConfig) Prepare(t *common.Template) []error {
|
func (c *AccessConfig) Prepare(t *packer.ConfigTemplate) []error {
|
||||||
if t == nil {
|
if t == nil {
|
||||||
var err error
|
var err error
|
||||||
t, err = common.NewTemplate()
|
t, err = packer.NewConfigTemplate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []error{err}
|
return []error{err}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/mitchellh/packer/common"
|
"github.com/mitchellh/packer/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AMIConfig is for common configuration related to creating AMIs.
|
// AMIConfig is for common configuration related to creating AMIs.
|
||||||
|
@ -14,10 +14,10 @@ type AMIConfig struct {
|
||||||
AMIProductCodes []string `mapstructure:"ami_product_codes"`
|
AMIProductCodes []string `mapstructure:"ami_product_codes"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *AMIConfig) Prepare(t *common.Template) []error {
|
func (c *AMIConfig) Prepare(t *packer.ConfigTemplate) []error {
|
||||||
if t == nil {
|
if t == nil {
|
||||||
var err error
|
var err error
|
||||||
t, err = common.NewTemplate()
|
t, err = packer.NewConfigTemplate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []error{err}
|
return []error{err}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package common
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/mitchellh/packer/common"
|
"github.com/mitchellh/packer/packer"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
@ -27,10 +27,10 @@ type RunConfig struct {
|
||||||
sshTimeout time.Duration
|
sshTimeout time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *RunConfig) Prepare(t *common.Template) []error {
|
func (c *RunConfig) Prepare(t *packer.ConfigTemplate) []error {
|
||||||
if t == nil {
|
if t == nil {
|
||||||
var err error
|
var err error
|
||||||
t, err = common.NewTemplate()
|
t, err = packer.NewConfigTemplate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []error{err}
|
return []error{err}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ type config struct {
|
||||||
// Tags for the AMI
|
// Tags for the AMI
|
||||||
Tags map[string]string
|
Tags map[string]string
|
||||||
|
|
||||||
tpl *common.Template
|
tpl *packer.ConfigTemplate
|
||||||
}
|
}
|
||||||
|
|
||||||
type Builder struct {
|
type Builder struct {
|
||||||
|
@ -42,7 +42,7 @@ func (b *Builder) Prepare(raws ...interface{}) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
b.config.tpl, err = common.NewTemplate()
|
b.config.tpl, err = packer.NewConfigTemplate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ type Config struct {
|
||||||
X509KeyPath string `mapstructure:"x509_key_path"`
|
X509KeyPath string `mapstructure:"x509_key_path"`
|
||||||
X509UploadPath string `mapstructure:"x509_upload_path"`
|
X509UploadPath string `mapstructure:"x509_upload_path"`
|
||||||
|
|
||||||
tpl *common.Template
|
tpl *packer.ConfigTemplate
|
||||||
}
|
}
|
||||||
|
|
||||||
type Builder struct {
|
type Builder struct {
|
||||||
|
@ -52,7 +52,7 @@ func (b *Builder) Prepare(raws ...interface{}) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
b.config.tpl, err = common.NewTemplate()
|
b.config.tpl, err = packer.NewConfigTemplate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ type config struct {
|
||||||
eventDelay time.Duration
|
eventDelay time.Duration
|
||||||
stateTimeout time.Duration
|
stateTimeout time.Duration
|
||||||
|
|
||||||
tpl *common.Template
|
tpl *packer.ConfigTemplate
|
||||||
}
|
}
|
||||||
|
|
||||||
type Builder struct {
|
type Builder struct {
|
||||||
|
@ -57,7 +57,7 @@ func (b *Builder) Prepare(raws ...interface{}) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
b.config.tpl, err = common.NewTemplate()
|
b.config.tpl, err = packer.NewConfigTemplate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ type config struct {
|
||||||
bootWait time.Duration ``
|
bootWait time.Duration ``
|
||||||
shutdownTimeout time.Duration ``
|
shutdownTimeout time.Duration ``
|
||||||
sshWaitTimeout time.Duration ``
|
sshWaitTimeout time.Duration ``
|
||||||
tpl *common.Template
|
tpl *packer.ConfigTemplate
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Prepare(raws ...interface{}) error {
|
func (b *Builder) Prepare(raws ...interface{}) error {
|
||||||
|
@ -66,7 +66,7 @@ func (b *Builder) Prepare(raws ...interface{}) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
b.config.tpl, err = common.NewTemplate()
|
b.config.tpl, err = packer.NewConfigTemplate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ type config struct {
|
||||||
bootWait time.Duration ``
|
bootWait time.Duration ``
|
||||||
shutdownTimeout time.Duration ``
|
shutdownTimeout time.Duration ``
|
||||||
sshWaitTimeout time.Duration ``
|
sshWaitTimeout time.Duration ``
|
||||||
tpl *common.Template
|
tpl *packer.ConfigTemplate
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Prepare(raws ...interface{}) error {
|
func (b *Builder) Prepare(raws ...interface{}) error {
|
||||||
|
@ -67,7 +67,7 @@ func (b *Builder) Prepare(raws ...interface{}) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
b.config.tpl, err = common.NewTemplate()
|
b.config.tpl, err = packer.NewConfigTemplate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ type AWSBoxConfig struct {
|
||||||
OutputPath string `mapstructure:"output"`
|
OutputPath string `mapstructure:"output"`
|
||||||
VagrantfileTemplate string `mapstructure:"vagrantfile_template"`
|
VagrantfileTemplate string `mapstructure:"vagrantfile_template"`
|
||||||
|
|
||||||
tpl *common.Template
|
tpl *packer.ConfigTemplate
|
||||||
}
|
}
|
||||||
|
|
||||||
type AWSVagrantfileTemplate struct {
|
type AWSVagrantfileTemplate struct {
|
||||||
|
@ -34,7 +34,7 @@ func (p *AWSBoxPostProcessor) Configure(raws ...interface{}) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
p.config.tpl, err = common.NewTemplate()
|
p.config.tpl, err = packer.NewConfigTemplate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ type VBoxBoxConfig struct {
|
||||||
OutputPath string `mapstructure:"output"`
|
OutputPath string `mapstructure:"output"`
|
||||||
VagrantfileTemplate string `mapstructure:"vagrantfile_template"`
|
VagrantfileTemplate string `mapstructure:"vagrantfile_template"`
|
||||||
|
|
||||||
tpl *common.Template
|
tpl *packer.ConfigTemplate
|
||||||
}
|
}
|
||||||
|
|
||||||
type VBoxVagrantfileTemplate struct {
|
type VBoxVagrantfileTemplate struct {
|
||||||
|
@ -36,7 +36,7 @@ func (p *VBoxBoxPostProcessor) Configure(raws ...interface{}) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
p.config.tpl, err = common.NewTemplate()
|
p.config.tpl, err = packer.NewConfigTemplate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ type VMwareBoxConfig struct {
|
||||||
OutputPath string `mapstructure:"output"`
|
OutputPath string `mapstructure:"output"`
|
||||||
VagrantfileTemplate string `mapstructure:"vagrantfile_template"`
|
VagrantfileTemplate string `mapstructure:"vagrantfile_template"`
|
||||||
|
|
||||||
tpl *common.Template
|
tpl *packer.ConfigTemplate
|
||||||
}
|
}
|
||||||
|
|
||||||
type VMwareBoxPostProcessor struct {
|
type VMwareBoxPostProcessor struct {
|
||||||
|
@ -28,7 +28,7 @@ func (p *VMwareBoxPostProcessor) Configure(raws ...interface{}) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
p.config.tpl, err = common.NewTemplate()
|
p.config.tpl, err = packer.NewConfigTemplate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ type config struct {
|
||||||
// The remote path where the local file will be uploaded to.
|
// The remote path where the local file will be uploaded to.
|
||||||
Destination string
|
Destination string
|
||||||
|
|
||||||
tpl *common.Template
|
tpl *packer.ConfigTemplate
|
||||||
}
|
}
|
||||||
|
|
||||||
type Provisioner struct {
|
type Provisioner struct {
|
||||||
|
@ -30,7 +30,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
p.config.tpl, err = common.NewTemplate()
|
p.config.tpl, err = packer.NewConfigTemplate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ type Config struct {
|
||||||
// Where files will be copied before moving to the /srv/salt directory
|
// Where files will be copied before moving to the /srv/salt directory
|
||||||
TempConfigDir string `mapstructure:"temp_config_dir"`
|
TempConfigDir string `mapstructure:"temp_config_dir"`
|
||||||
|
|
||||||
tpl *common.Template
|
tpl *packer.ConfigTemplate
|
||||||
}
|
}
|
||||||
|
|
||||||
type Provisioner struct {
|
type Provisioner struct {
|
||||||
|
@ -40,7 +40,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
p.config.tpl, err = common.NewTemplate()
|
p.config.tpl, err = packer.NewConfigTemplate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ type config struct {
|
||||||
RawStartRetryTimeout string `mapstructure:"start_retry_timeout"`
|
RawStartRetryTimeout string `mapstructure:"start_retry_timeout"`
|
||||||
|
|
||||||
startRetryTimeout time.Duration
|
startRetryTimeout time.Duration
|
||||||
tpl *common.Template
|
tpl *packer.ConfigTemplate
|
||||||
}
|
}
|
||||||
|
|
||||||
type Provisioner struct {
|
type Provisioner struct {
|
||||||
|
@ -70,7 +70,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
p.config.tpl, err = common.NewTemplate()
|
p.config.tpl, err = packer.NewConfigTemplate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue