diff --git a/helper/communicator/config.go b/helper/communicator/config.go index 28d1d3a43..a2719db13 100644 --- a/helper/communicator/config.go +++ b/helper/communicator/config.go @@ -35,8 +35,10 @@ func (c *Config) Prepare(ctx *interpolate.Context) []error { // Validation var errs []error - if c.SSHUsername == "" { - errs = append(errs, errors.New("An ssh_username must be specified")) + if c.Type == "ssh" { + if c.SSHUsername == "" { + errs = append(errs, errors.New("An ssh_username must be specified")) + } } return errs diff --git a/helper/communicator/config_test.go b/helper/communicator/config_test.go index f57fb68ca..029c9fe35 100644 --- a/helper/communicator/config_test.go +++ b/helper/communicator/config_test.go @@ -23,6 +23,13 @@ func TestConfigType(t *testing.T) { } } +func TestConfig_none(t *testing.T) { + c := &Config{Type: "none"} + if err := c.Prepare(testContext(t)); len(err) > 0 { + t.Fatalf("bad: %#v", err) + } +} + func testContext(t *testing.T) *interpolate.Context { return nil }