helper/communicator: ssh settings aren't required if type is none
This commit is contained in:
parent
4b4fe2280d
commit
60081c323a
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue