Merge pull request #4300 from don-code/master

Allow skipping Chef Client staging directory cleanup.
pull/6229/head
M. Marsh 8 years ago committed by GitHub
commit 23e51d21c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -63,6 +63,7 @@ type Config struct {
ServerUrl string `mapstructure:"server_url"` ServerUrl string `mapstructure:"server_url"`
SkipCleanClient bool `mapstructure:"skip_clean_client"` SkipCleanClient bool `mapstructure:"skip_clean_client"`
SkipCleanNode bool `mapstructure:"skip_clean_node"` SkipCleanNode bool `mapstructure:"skip_clean_node"`
SkipCleanStagingDirectory bool `mapstructure:"skip_clean_staging_directory"`
SkipInstall bool `mapstructure:"skip_install"` SkipInstall bool `mapstructure:"skip_install"`
SslVerifyMode string `mapstructure:"ssl_verify_mode"` SslVerifyMode string `mapstructure:"ssl_verify_mode"`
TrustedCertsDir string `mapstructure:"trusted_certs_dir"` TrustedCertsDir string `mapstructure:"trusted_certs_dir"`
@ -319,8 +320,10 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
return fmt.Errorf("Error executing Chef: %s", err) return fmt.Errorf("Error executing Chef: %s", err)
} }
if err := p.removeDir(ui, comm, p.config.StagingDir); err != nil { if !p.config.SkipCleanStagingDirectory {
return fmt.Errorf("Error removing %s: %s", p.config.StagingDir, err) if err := p.removeDir(ui, comm, p.config.StagingDir); err != nil {
return fmt.Errorf("Error removing %s: %s", p.config.StagingDir, err)
}
} }
return nil return nil

@ -104,6 +104,9 @@ configuration is actually required.
- `skip_clean_node` (boolean) - If true, Packer won't remove the node from the - `skip_clean_node` (boolean) - If true, Packer won't remove the node from the
Chef server after it is done running. By default, this is false. Chef server after it is done running. By default, this is false.
- `skip_clean_staging_directory` (boolean) - If true, Packer won't remove the Chef staging
directory from the machine after it is done running. By default, this is false.
- `skip_install` (boolean) - If true, Chef will not automatically be installed - `skip_install` (boolean) - If true, Chef will not automatically be installed
on the machine using the Chef omnibus installers. on the machine using the Chef omnibus installers.

Loading…
Cancel
Save