Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
'communicator: none' can be used to clone and customize VMs without p…
Browse files Browse the repository at this point in the history
…rovisioning
  • Loading branch information
Michael Kuzmin authored and mkuzmin committed Jan 16, 2018
1 parent ede053f commit b667f68
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
state.Put("hook", hook)
state.Put("ui", ui)

steps := []multistep.Step{
var steps []multistep.Step

steps = append(steps,
&StepConnect{
config: &b.config.ConnectConfig,
},
Expand All @@ -41,23 +43,31 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
&StepConfigureHardware{
config: &b.config.HardwareConfig,
},
&StepRun{},
&communicator.StepConnect{
Config: &b.config.Comm,
Host: commHost,
SSHConfig: sshConfig,
},
&common.StepProvision{},
&StepShutdown{
config: &b.config.ShutdownConfig,
},
)

if b.config.Comm.Type != "none" {
steps = append(steps,
&StepRun{},
&communicator.StepConnect{
Config: &b.config.Comm,
Host: commHost,
SSHConfig: sshConfig,
},
&common.StepProvision{},
&StepShutdown{
config: &b.config.ShutdownConfig,
},
)
}

steps = append(steps,
&StepCreateSnapshot{
createSnapshot: b.config.CreateSnapshot,
},
&StepConvertToTemplate{
ConvertToTemplate: b.config.ConvertToTemplate,
},
}
)

// Run!
b.runner = common.NewRunner(steps, b.config.PackerConfig, ui)
Expand Down

0 comments on commit b667f68

Please sign in to comment.