From f3811cb99d7c969ed9359940772e9f42845f7bf8 Mon Sep 17 00:00:00 2001 From: Keyan Pishdadian Date: Sun, 13 Mar 2016 23:39:18 -0400 Subject: [PATCH 1/2] Add ignore_exit_codes param for puppet-masterless provisioner --- provisioner/puppet-masterless/provisioner.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/provisioner/puppet-masterless/provisioner.go b/provisioner/puppet-masterless/provisioner.go index 7e2b6a0ef..ceff3edb3 100644 --- a/provisioner/puppet-masterless/provisioner.go +++ b/provisioner/puppet-masterless/provisioner.go @@ -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) } From aee8490f681562e6f46c1cb7e07910083ff5ff39 Mon Sep 17 00:00:00 2001 From: Keyan Pishdadian Date: Sun, 13 Mar 2016 23:39:29 -0400 Subject: [PATCH 2/2] Add docs for ignore_exit_codes param --- website/source/docs/provisioners/puppet-masterless.html.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/website/source/docs/provisioners/puppet-masterless.html.md b/website/source/docs/provisioners/puppet-masterless.html.md index 783192b8e..b8c6a73cd 100644 --- a/website/source/docs/provisioners/puppet-masterless.html.md +++ b/website/source/docs/provisioners/puppet-masterless.html.md @@ -73,6 +73,9 @@ Optional parameters: configuration to be uploaded to the remote machine. Hiera data directories must be uploaded using the file provisioner separately. +- `ignore_exit_codes` (boolean) - If true, Packer will never consider the + provisioner a failure. + - `manifest_dir` (string) - The path to a local directory with manifests to be uploaded to the remote machine. This is useful if your main manifest file uses imports. This directory doesn't necessarily contain the