Skip to content

Commit

Permalink
Add support for salt_bin_dir
Browse files Browse the repository at this point in the history
Allows specifying the path to salt-call, useful if it isn't on the
path.
  • Loading branch information
sjlamerton committed Jun 7, 2017
1 parent 07c09fe commit e953898
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion provisioner/salt-masterless/provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ type Config struct {
// Arguments to pass to salt-call
SaltCallArgs string `mapstructure:"salt_call_args"`

// Directory containing salt-call
SaltBinDir string `mapstructure:"salt_bin_dir"`

// Command line args passed onto salt-call
CmdArgs string ""

Expand Down Expand Up @@ -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))
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 == nil {
err = fmt.Errorf("Bad exit status: %d", cmd.ExitStatus)
Expand Down
3 changes: 3 additions & 0 deletions website/source/docs/provisioners/salt-masterless.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,6 @@ Optional:
[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)
are passed to `salt-call`.

- `salt_bin_dir` (string) - Path to the `salt-call` executable. Useful if it is not
on the PATH.

0 comments on commit e953898

Please sign in to comment.