Add ignore_exit_codes key for provisioner puppet-server

This commit is contained in:
Francisco Lopez 2015-05-14 15:05:44 -07:00
parent c8b3dfff5f
commit 758618ecaa
1 changed files with 5 additions and 1 deletions

View File

@ -38,6 +38,10 @@ type Config struct {
// The directory where files will be uploaded. Packer requires write
// permissions in this directory.
StagingDir string `mapstructure:"staging_dir"`
// If true, packer will ignore all exit-codes from a puppet run
IgnoreExitCodes bool `mapstructure:"ignore_exit_codes"`
}
type Provisioner struct {
@ -200,7 +204,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)
}