diff --git a/provisioner/shell/provisioner.go b/provisioner/shell/provisioner.go index c5b3ee7c5..346382e43 100644 --- a/provisioner/shell/provisioner.go +++ b/provisioner/shell/provisioner.go @@ -26,7 +26,7 @@ type config struct { Inline []string // The local path of the shell script to upload and execute. - Path string + Script string // An array of multiple scripts to run. Scripts []string @@ -73,12 +73,12 @@ func (p *Provisioner) Prepare(raws ...interface{}) error { errs := make([]error, 0) - if p.config.Path != "" && len(p.config.Scripts) > 0 { - errs = append(errs, errors.New("Only one of path or scripts can be specified.")) + if p.config.Script != "" && len(p.config.Scripts) > 0 { + errs = append(errs, errors.New("Only one of script or scripts can be specified.")) } - if p.config.Path != "" { - p.config.Scripts = []string{p.config.Path} + if p.config.Script != "" { + p.config.Scripts = []string{p.config.Script} } if len(p.config.Scripts) == 0 && p.config.Inline == nil { diff --git a/provisioner/shell/provisioner_test.go b/provisioner/shell/provisioner_test.go index bb4209051..1e061a301 100644 --- a/provisioner/shell/provisioner_test.go +++ b/provisioner/shell/provisioner_test.go @@ -35,11 +35,11 @@ func TestProvisionerPrepare_Defaults(t *testing.T) { } } -func TestProvisionerPrepare_Path(t *testing.T) { +func TestProvisionerPrepare_Script(t *testing.T) { config := testConfig() delete(config, "inline") - config["path"] = "/this/should/not/exist" + config["script"] = "/this/should/not/exist" p := new(Provisioner) err := p.Prepare(config) if err == nil { @@ -53,7 +53,7 @@ func TestProvisionerPrepare_Path(t *testing.T) { } defer os.Remove(tf.Name()) - config["path"] = tf.Name() + config["script"] = tf.Name() p = new(Provisioner) err = p.Prepare(config) if err != nil { @@ -61,12 +61,12 @@ func TestProvisionerPrepare_Path(t *testing.T) { } } -func TestProvisionerPrepare_PathAndInline(t *testing.T) { +func TestProvisionerPrepare_ScriptAndInline(t *testing.T) { var p Provisioner config := testConfig() delete(config, "inline") - delete(config, "path") + delete(config, "script") err := p.Prepare(config) if err == nil { t.Fatal("should have error") @@ -80,14 +80,14 @@ func TestProvisionerPrepare_PathAndInline(t *testing.T) { defer os.Remove(tf.Name()) config["inline"] = []interface{}{"foo"} - config["path"] = tf.Name() + config["script"] = tf.Name() err = p.Prepare(config) if err == nil { t.Fatal("should have error") } } -func TestProvisionerPrepare_PathAndScripts(t *testing.T) { +func TestProvisionerPrepare_ScriptAndScripts(t *testing.T) { var p Provisioner config := testConfig()