Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions pkg/utils/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,10 +476,6 @@ func LoadConfig(filename, currentUsername, sid string, start time.Time, groups m
cachedConfig.Environment[k] = replace(v, patterns["{user}"])
}

if len(cachedConfig.Dest) == 0 {
return nil, fmt.Errorf("no destination defined for service '%s'", cachedConfig.Service)
}

// expand destination nodesets
nodesetComment, nodesetDlclose, nodesetExpand := nodesets.InitExpander()
defer nodesetDlclose()
Expand Down
27 changes: 26 additions & 1 deletion pkg/utils/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,32 @@ var loadConfigTests = []struct {
err string
}{
{"nonexistingfile.yaml", "alice", []string{}, "open nonexistingfile.yaml: no such file or directory"},
{"../../test/configEmpty.yaml", "alice", []string{}, "no destination defined for service 'default'"},
{"../../test/configEmpty.yaml", "alice", []string{
"libnodeset.so not found, falling back to iskylite's implementation",
"groups = map[bar:true foo:true]",
"config.debug = false",
"config.log = ",
"config.check_interval = 0s",
"config.error_banner = ",
"config.dump = ",
"config.dump_limit_size = 0",
"config.dump_limit_window = 0s",
"config.etcd = {Endpoints:[] TLS:{CAFile: KeyFile: CertFile:} Username: Password: KeyTTL:0 Mandatory:<nil>}",
"config.etcd_stats_interval = 0s",
"config.log_stats_interval = 0s",
"config.blocking_command = ",
"config.bg_command = ",
"config.ssh = {Exe:ssh Args:[-q -Y]}",
"config.environment = map[]",
"config.service = default",
"config.dest = []",
"config.route_select = ordered",
"config.mode = sticky",
"config.force_command = ",
"config.command_must_match = false",
"config.etcd_keyttl = 0",
"config.max_connections_per_user = 0",
}, ""},
{"../../test/configInvalid.yaml", "alice", []string{}, "yaml: found character that cannot start any token"},
{"../../test/configCheckIntervalError.yaml", "alice", []string{}, `time: invalid duration "not a duration"`},
{"../../test/configCheckIntervalNotString.yaml", "alice", []string{}, "check_interval: 10 is not a string"},
Expand Down