diff --git a/helper/communicator/config.go b/helper/communicator/config.go index 0f19c4e68..53de3f81e 100644 --- a/helper/communicator/config.go +++ b/helper/communicator/config.go @@ -65,6 +65,10 @@ func (c *Config) Prepare(ctx *interpolate.Context) []error { if es := c.prepareWinRM(ctx); len(es) > 0 { errs = append(errs, es...) } + case "none": + break + default: + return []error{fmt.Errorf("Communicator type %s is invalid", c.Type)} } return errs diff --git a/helper/communicator/config_test.go b/helper/communicator/config_test.go index dc1bd965d..cbdaafa98 100644 --- a/helper/communicator/config_test.go +++ b/helper/communicator/config_test.go @@ -30,6 +30,23 @@ func TestConfig_none(t *testing.T) { } } +func TestConfig_badtype(t *testing.T) { + c := &Config{Type: "foo"} + if err := c.Prepare(testContext(t)); len(err) != 1 { + t.Fatalf("bad: %#v", err) + } +} + +func TestConfig_winrm(t *testing.T) { + c := &Config{ + Type: "winrm", + WinRMUser: "admin", + } + if err := c.Prepare(testContext(t)); len(err) > 0 { + t.Fatalf("bad: %#v", err) + } +} + func testContext(t *testing.T) *interpolate.Context { return nil }