Merge pull request #2280 from flopex/ignore_exit_codes

provisioner/puppet-server: Add ignore exit codes option
This commit is contained in:
Mitchell Hashimoto 2015-06-19 06:08:29 +02:00
commit 873bc7471f
1 changed files with 5 additions and 1 deletions

View File

@ -41,6 +41,10 @@ type Config struct {
// The directory where files will be uploaded. Packer requires write // The directory where files will be uploaded. Packer requires write
// permissions in this directory. // permissions in this directory.
StagingDir string `mapstructure:"staging_dir"` 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 { type Provisioner struct {
@ -163,7 +167,7 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
return err 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) return fmt.Errorf("Puppet exited with a non-zero exit status: %d", cmd.ExitStatus)
} }