Merge pull request #4624 from anish/fix_null
Make null builder actually have the ability to do nothing
This commit is contained in:
commit
950861460e
|
@ -27,7 +27,10 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
|
|||
}
|
||||
|
||||
func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error) {
|
||||
steps := []multistep.Step{
|
||||
steps := []multistep.Step{}
|
||||
|
||||
if b.config.CommConfig.Type != "none" {
|
||||
steps = append(steps,
|
||||
&communicator.StepConnect{
|
||||
Config: &b.config.CommConfig,
|
||||
Host: CommHost(b.config.CommConfig.Host()),
|
||||
|
@ -37,9 +40,13 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||
b.config.CommConfig.SSHPassword,
|
||||
b.config.CommConfig.SSHPrivateKey),
|
||||
},
|
||||
&common.StepProvision{},
|
||||
)
|
||||
}
|
||||
|
||||
steps = append(steps,
|
||||
new(common.StepProvision),
|
||||
)
|
||||
|
||||
// Setup the state bag and initial state for the steps
|
||||
state := new(multistep.BasicStateBag)
|
||||
state.Put("config", b.config)
|
||||
|
|
|
@ -31,6 +31,8 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
|
|||
if es := c.CommConfig.Prepare(nil); len(es) > 0 {
|
||||
errs = packer.MultiErrorAppend(errs, es...)
|
||||
}
|
||||
|
||||
if c.CommConfig.Type != "none" {
|
||||
if c.CommConfig.Host() == "" {
|
||||
errs = packer.MultiErrorAppend(errs,
|
||||
fmt.Errorf("a Host must be specified, please reference your communicator documentation"))
|
||||
|
@ -51,6 +53,8 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
|
|||
(c.CommConfig.SSHPassword != "" && c.CommConfig.SSHPrivateKey != "") {
|
||||
errs = packer.MultiErrorAppend(errs,
|
||||
fmt.Errorf("only one of ssh_agent_auth, ssh_password, and ssh_private_key_file must be specified"))
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if errs != nil && len(errs.Errors) > 0 {
|
||||
|
|
Loading…
Reference in New Issue