diff --git a/plugin.go b/plugin.go index 98f62b4..d857be9 100644 --- a/plugin.go +++ b/plugin.go @@ -70,9 +70,15 @@ func trimPath(keys []string) []string { func (p Plugin) Exec() error { if len(p.Config.Host) == 0 || len(p.Config.Username) == 0 || (len(p.Config.Password) == 0 && len(p.Config.Key) == 0) { - log.Println("missing ssh config") + log.Println("missing ssh config (Host, Username, Password or Key)") - return errors.New("missing ssh config") + return errors.New("missing ssh config (Host, Username, Password or Key)") + } + + if len(p.Config.Source) == 0 { + log.Println("missing source file list config") + + return errors.New("missing source file list config") } files := trimPath(p.Config.Source) diff --git a/plugin_test.go b/plugin_test.go index 46fe72d..bc55c18 100644 --- a/plugin_test.go +++ b/plugin_test.go @@ -27,6 +27,21 @@ func TestMissingSSHConfig(t *testing.T) { assert.NotNil(t, err) } +func TestMissingSourceConfig(t *testing.T) { + plugin := Plugin{ + Config: Config{ + Host: "example.com", + Username: "ubuntu", + Port: "443", + Password: "1234", + }, + } + + err := plugin.Exec() + + assert.NotNil(t, err) +} + func TestTrimElement(t *testing.T) { var input, result []string