Skip to content

Commit b66e93d

Browse files
authored
[v18] Fix spurious warning when tbot is initialised prior to teleport configure (#60255)
* Fix spurious warning when `tbot` is installed prior to `teleport configure` * Use slices.DeleteFunc
1 parent 55741ad commit b66e93d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tool/teleport/common/teleport.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,6 +1012,12 @@ func onConfigDump(flags dumpFlags) error {
10121012
os.Stderr, "%s Could not check the contents of %s: %s\n The data directory may contain existing cluster state.\n", utils.Color(utils.Yellow, "WARNING:"), flags.DataDir, err.Error())
10131013
}
10141014

1015+
// Filter out the default directory /var/lib/teleport/bot used by `tbot` to
1016+
// avoid throwing a scary warning if `tbot` was installed prior to
1017+
// configuring teleport.
1018+
entries = slices.DeleteFunc(entries, func(entry os.DirEntry) bool {
1019+
return entry.Name() == "bot"
1020+
})
10151021
if err == nil && len(entries) != 0 {
10161022
fmt.Fprintf(
10171023
os.Stderr,

0 commit comments

Comments
 (0)