From 934263be31c96a16cb5e0b12b5c38079c1cf92c5 Mon Sep 17 00:00:00 2001 From: Tim Buckley Date: Tue, 22 Oct 2024 20:51:26 -0600 Subject: [PATCH] Fix lints --- lib/tbot/cli/start_database.go | 8 ++++---- lib/tbot/cli/start_identity.go | 2 +- lib/tbot/cli/start_shared.go | 2 +- lib/tbot/config/destination_directory.go | 16 +++++++++------- lib/tbot/config/destination_directory_test.go | 2 +- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/lib/tbot/cli/start_database.go b/lib/tbot/cli/start_database.go index d6cedf9943ed..d0b5648051e7 100644 --- a/lib/tbot/cli/start_database.go +++ b/lib/tbot/cli/start_database.go @@ -34,10 +34,10 @@ type DatabaseCommand struct { *sharedDestinationArgs *genericMutatorHandler - Format string - Service string - Username string - Database string + Format string + Service string + Username string + Database string } // NewDatabaseCommand initializes a command and flags for database outputs and diff --git a/lib/tbot/cli/start_identity.go b/lib/tbot/cli/start_identity.go index 9a10a21d7fb2..dec8c817df6d 100644 --- a/lib/tbot/cli/start_identity.go +++ b/lib/tbot/cli/start_identity.go @@ -34,7 +34,7 @@ type IdentityCommand struct { *sharedDestinationArgs *genericMutatorHandler - Cluster string + Cluster string } // NewIdentityCommand initializes the command and flags for identity outputs diff --git a/lib/tbot/cli/start_shared.go b/lib/tbot/cli/start_shared.go index 89f3c812c014..ba3501f8b6f8 100644 --- a/lib/tbot/cli/start_shared.go +++ b/lib/tbot/cli/start_shared.go @@ -238,7 +238,7 @@ func (s *sharedStartArgs) ApplyConfig(cfg *config.BotConfig, l *slog.Logger) err // sharedDestinationArgs are arguments common to all commands that accept a // --destination flag and any related flags. Downstream commands will need to -// call `BuildDestination()` to retreive the value. +// call `BuildDestination()` to retrieve the value. type sharedDestinationArgs struct { Destination string ReaderUsers []string diff --git a/lib/tbot/config/destination_directory.go b/lib/tbot/config/destination_directory.go index 1680bc06c55c..9721de9dcdfd 100644 --- a/lib/tbot/config/destination_directory.go +++ b/lib/tbot/config/destination_directory.go @@ -168,12 +168,13 @@ func (dd *DestinationDirectory) Init(ctx context.Context, subdirs []string) erro "underlying issue.") } + const msg = "ACLs were requested but could not be configured, they " + + "will be disabled. To resolve this warning, ensure ACLs are " + + "supported and the directory is owned by the bot user, or " + + "remove any configured readers to disable ACLs" log.WarnContext( ctx, - "ACLs were requested but could not be configured, they will be "+ - "disabled. To resolve this warning, ensure ACLs are supported "+ - "and the directory is owned by the bot user, or remove any "+ - "configured readers to disable ACLs", + msg, "path", dd.Path, "error", err, "readers", dd.Readers, @@ -322,11 +323,12 @@ func (dd *DestinationDirectory) Verify(keys []string) error { if len(dd.Readers) > 0 { // TODO: consider moving ownership check into Init()? if !ownedByBot { + const msg = "This destination is not owned by the bot user so ACLs " + + "will not be enforced. To silence this warning, fix destination " + + "file ownership or remove configured `readers`" log.WarnContext( context.TODO(), - "This destination is not owned by the bot user so ACLs will "+ - "not be enforced. To silence this warning, fix destination "+ - "file ownership or remove configured `readers`", + msg, "path", dd.Path, ) diff --git a/lib/tbot/config/destination_directory_test.go b/lib/tbot/config/destination_directory_test.go index 52690fdf50a5..d0b78257f019 100644 --- a/lib/tbot/config/destination_directory_test.go +++ b/lib/tbot/config/destination_directory_test.go @@ -24,11 +24,11 @@ import ( "path/filepath" "testing" + "github.com/gravitational/trace" "github.com/stretchr/testify/require" "github.com/gravitational/teleport/lib/tbot/botfs" "github.com/gravitational/teleport/lib/utils" - "github.com/gravitational/trace" ) func TestDestinationDirectory_Lock(t *testing.T) {