From 3654a9a9f5fb6ab4ada756b7e18606b0b246a3f0 Mon Sep 17 00:00:00 2001 From: Rafael Garcia Date: Fri, 26 Jul 2013 14:14:41 -0700 Subject: [PATCH] provisioner/salt: pass args to bootstrap --- provisioner/salt/provisioner.go | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/provisioner/salt/provisioner.go b/provisioner/salt/provisioner.go index 2912a3df8..c934cf509 100644 --- a/provisioner/salt/provisioner.go +++ b/provisioner/salt/provisioner.go @@ -16,8 +16,9 @@ import ( var Ui packer.Ui type config struct { - // If true, skips installing Salt. Defaults to false. - SkipInstall bool `mapstructure:"skip_install"` + // If true, run the salt-bootstrap script + SkipBootstrap bool `mapstructure:"skip_bootstrap"` + BootstrapArgs string `mapstructure:"bootstrap_args"` } type Provisioner struct { @@ -64,26 +65,17 @@ func (p *Provisioner) Prepare(raws ...interface{}) error { return nil } -func InstallSalt(comm packer.Communicator) (err error) { - Ui.Say("Installing Salt") - cmd := "wget -O - http://bootstrap.saltstack.org | sudo sh" - if err = executeCommand(cmd, comm); err != nil { - return fmt.Errorf("Unable to install Salt: %d", err) - } - - return nil -} - func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error { var err error Ui = ui - if !p.config.SkipInstall { - if err = InstallSalt(comm); err != nil { - return fmt.Errorf("Error installing Salt: %s", err) + if !p.config.SkipBootstrap { + cmd := fmt.Sprintf("wget -O - http://bootstrap.saltstack.org | sudo sh -s %s", p.config.BootstrapArgs) + Ui.Say(fmt.Sprintf("Installing Salt with command %s", cmd)) + if err = executeCommand(cmd, comm); err != nil { + return fmt.Errorf("Unable to install Salt: %d", err) } } - return nil }