parent
95d107a89c
commit
31afd1c2f8
|
@ -45,6 +45,11 @@ type Config struct {
|
||||||
// your command(s) are executed.
|
// your command(s) are executed.
|
||||||
Vars []string `mapstructure:"environment_vars"`
|
Vars []string `mapstructure:"environment_vars"`
|
||||||
|
|
||||||
|
// A duration of how long to pause after the provisioner
|
||||||
|
RawPauseAfter string `mapstructure:"pause_after"`
|
||||||
|
|
||||||
|
PauseAfter time.Duration
|
||||||
|
|
||||||
// Write the Vars to a file and source them from there rather than declaring
|
// Write the Vars to a file and source them from there rather than declaring
|
||||||
// inline
|
// inline
|
||||||
UseEnvVarFile bool `mapstructure:"use_env_var_file"`
|
UseEnvVarFile bool `mapstructure:"use_env_var_file"`
|
||||||
|
@ -189,6 +194,14 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if p.config.RawPauseAfter != "" {
|
||||||
|
p.config.PauseAfter, err = time.ParseDuration(p.config.RawPauseAfter)
|
||||||
|
if err != nil {
|
||||||
|
errs = packer.MultiErrorAppend(
|
||||||
|
errs, fmt.Errorf("Failed parsing pause_after: %s", err))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if errs != nil && len(errs.Errors) > 0 {
|
if errs != nil && len(errs.Errors) > 0 {
|
||||||
return errs
|
return errs
|
||||||
}
|
}
|
||||||
|
@ -371,7 +384,16 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if p.config.RawPauseAfter != "" {
|
||||||
|
ui.Say(fmt.Sprintf("Pausing %s after this provisioner...", p.config.PauseAfter))
|
||||||
|
select {
|
||||||
|
case <-time.After(p.config.PauseAfter):
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Provisioner) cleanupRemoteFile(path string, comm packer.Communicator) error {
|
func (p *Provisioner) cleanupRemoteFile(path string, comm packer.Communicator) error {
|
||||||
|
|
|
@ -115,6 +115,9 @@ Optional parameters:
|
||||||
system reboot. Set this to a higher value if reboots take a longer amount
|
system reboot. Set this to a higher value if reboots take a longer amount
|
||||||
of time.
|
of time.
|
||||||
|
|
||||||
|
- `pause_after` (string) - Wait the amount of time after provisioning a shell
|
||||||
|
script, this pause be taken if all previous steps were successful.
|
||||||
|
|
||||||
## Execute Command Example
|
## Execute Command Example
|
||||||
|
|
||||||
To many new users, the `execute_command` is puzzling. However, it provides an
|
To many new users, the `execute_command` is puzzling. However, it provides an
|
||||||
|
|
Loading…
Reference in New Issue