Merge pull request #3349 from keyan/master
provisioner/puppet-masterless: Add ignore exit codes option
This commit is contained in:
commit
9d1a6b08d6
|
@ -54,6 +54,9 @@ type Config struct {
|
||||||
// The directory from which the command will be executed.
|
// The directory from which the command will be executed.
|
||||||
// Packer requires the directory to exist when running puppet.
|
// Packer requires the directory to exist when running puppet.
|
||||||
WorkingDir string `mapstructure:"working_directory"`
|
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 {
|
type Provisioner struct {
|
||||||
|
@ -242,7 +245,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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,9 @@ Optional parameters:
|
||||||
configuration to be uploaded to the remote machine. Hiera data directories
|
configuration to be uploaded to the remote machine. Hiera data directories
|
||||||
must be uploaded using the file provisioner separately.
|
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
|
- `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
|
uploaded to the remote machine. This is useful if your main manifest file
|
||||||
uses imports. This directory doesn't necessarily contain the
|
uses imports. This directory doesn't necessarily contain the
|
||||||
|
|
Loading…
Reference in New Issue