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 {
// 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
......
......@@ -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
}
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