Commit 60081c32 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

helper/communicator: ssh settings aren't required if type is none

parent 4b4fe228
...@@ -35,8 +35,10 @@ func (c *Config) Prepare(ctx *interpolate.Context) []error { ...@@ -35,8 +35,10 @@ func (c *Config) Prepare(ctx *interpolate.Context) []error {
// Validation // Validation
var errs []error var errs []error
if c.SSHUsername == "" { if c.Type == "ssh" {
errs = append(errs, errors.New("An ssh_username must be specified")) if c.SSHUsername == "" {
errs = append(errs, errors.New("An ssh_username must be specified"))
}
} }
return errs return errs
......
...@@ -23,6 +23,13 @@ func TestConfigType(t *testing.T) { ...@@ -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 { func testContext(t *testing.T) *interpolate.Context {
return nil return nil
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment