Update to make NoExitOnFailure work correctly. (#9119)

if NoExitOnFailure is true then ignore the error returned from salt.
This commit is contained in:
DamianBis 2020-04-27 18:48:19 +10:00 committed by GitHub
parent 75efe3fcd1
commit b679f61536
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -347,7 +347,7 @@ func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.C
ui.Message(fmt.Sprintf("Running: salt-call --local %s", p.config.CmdArgs))
cmd := &packer.RemoteCmd{Command: p.sudo(fmt.Sprintf("%s --local %s", filepath.Join(p.config.SaltBinDir, "salt-call"), p.config.CmdArgs))}
if err = cmd.RunWithUi(ctx, comm, ui); err != nil || cmd.ExitStatus() != 0 {
if err = cmd.RunWithUi(ctx, comm, ui); (err != nil || cmd.ExitStatus() != 0) && !p.config.NoExitOnFailure {
if err == nil {
err = fmt.Errorf("Bad exit status: %d", cmd.ExitStatus())
}