Add ignore_exit_codes param for puppet-masterless provisioner

This commit is contained in:
Keyan Pishdadian 2016-03-13 23:39:18 -04:00
parent e464a8b8d8
commit f3811cb99d
1 changed files with 4 additions and 1 deletions

View File

@ -54,6 +54,9 @@ type Config struct {
// The directory from which the command will be executed.
// Packer requires the directory to exist when running puppet.
WorkingDir string `mapstructure:"working_directory"`
// If true, packer will ignore all exit-codes from a puppet run
IgnoreExitCodes bool `mapstructure:"ignore_exit_codes"`
}
type Provisioner struct {
@ -242,7 +245,7 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
return err
}
if cmd.ExitStatus != 0 && cmd.ExitStatus != 2 {
if cmd.ExitStatus != 0 && cmd.ExitStatus != 2 && !p.config.IgnoreExitCodes {
return fmt.Errorf("Puppet exited with a non-zero exit status: %d", cmd.ExitStatus)
}