Skip to content

Commit deab076

Browse files
authored
[v16] Fix spurious warning when tbot is initialised prior to teleport configure (#60257)
* Fix spurious warning when `tbot` is installed prior to `teleport configure` * Use slices.DeleteFunc * Add slices package
1 parent 72dace5 commit deab076

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tool/teleport/common/teleport.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
"os/user"
2929
"path"
3030
"path/filepath"
31+
"slices"
3132
"strconv"
3233
"strings"
3334

@@ -906,6 +907,12 @@ func onConfigDump(flags dumpFlags) error {
906907
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())
907908
}
908909

910+
// Filter out the default directory /var/lib/teleport/bot used by `tbot` to
911+
// avoid throwing a scary warning if `tbot` was installed prior to
912+
// configuring teleport.
913+
entries = slices.DeleteFunc(entries, func(entry os.DirEntry) bool {
914+
return entry.Name() == "bot"
915+
})
909916
if err == nil && len(entries) != 0 {
910917
fmt.Fprintf(
911918
os.Stderr,

0 commit comments

Comments
 (0)