Merge pull request #5009 from sjlamerton/salt_bin_dir
Add support for salt_bin_dir
This commit is contained in:
commit
11379dea70
|
@ -61,6 +61,9 @@ type Config struct {
|
||||||
// Arguments to pass to salt-call
|
// Arguments to pass to salt-call
|
||||||
SaltCallArgs string `mapstructure:"salt_call_args"`
|
SaltCallArgs string `mapstructure:"salt_call_args"`
|
||||||
|
|
||||||
|
// Directory containing salt-call
|
||||||
|
SaltBinDir string `mapstructure:"salt_bin_dir"`
|
||||||
|
|
||||||
// Command line args passed onto salt-call
|
// Command line args passed onto salt-call
|
||||||
CmdArgs string ""
|
CmdArgs string ""
|
||||||
|
|
||||||
|
@ -281,7 +284,7 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.Message(fmt.Sprintf("Running: salt-call --local %s", p.config.CmdArgs))
|
ui.Message(fmt.Sprintf("Running: salt-call --local %s", p.config.CmdArgs))
|
||||||
cmd := &packer.RemoteCmd{Command: p.sudo(fmt.Sprintf("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.StartWithUi(comm, ui); err != nil || cmd.ExitStatus != 0 {
|
if err = cmd.StartWithUi(comm, ui); err != nil || cmd.ExitStatus != 0 {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = fmt.Errorf("Bad exit status: %d", cmd.ExitStatus)
|
err = fmt.Errorf("Bad exit status: %d", cmd.ExitStatus)
|
||||||
|
|
|
@ -86,3 +86,6 @@ Optional:
|
||||||
[salt-call](https://docs.saltstack.com/ref/cli/salt-call.html) documentation for more
|
[salt-call](https://docs.saltstack.com/ref/cli/salt-call.html) documentation for more
|
||||||
information. By default no additional arguments (besides the ones Packer generates)
|
information. By default no additional arguments (besides the ones Packer generates)
|
||||||
are passed to `salt-call`.
|
are passed to `salt-call`.
|
||||||
|
|
||||||
|
- `salt_bin_dir` (string) - Path to the `salt-call` executable. Useful if it is not
|
||||||
|
on the PATH.
|
||||||
|
|
Loading…
Reference in New Issue