Skip to content

Commit

Permalink
Lift the checks for the logs secret up.
Browse files Browse the repository at this point in the history
  • Loading branch information
opudrovs committed Feb 24, 2023
1 parent dffb143 commit 9103dea
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions core/server/session_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ func (cs *coreServer) GetSessionLogs(ctx context.Context, msg *pb.GetSessionLogs
fluxNamespace = "flux-system"
}

logSourceFilter := msg.GetLogSourceFilter()
isLoadingGitOpsRunLogs := logSourceFilter == "" || logSourceFilter == logger.SessionLogSource
// check if we can get session logs already
// if the secret is not created yet, we should not display an error in the browser console
if err = isSecretCreated(ctx, cli, constants.GitOpsRunNamespace, constants.RunDevBucketCredentials); err != nil {
return &pb.GetSessionLogsResponse{Error: secretNotFound}, nil
}

info, err := getBucketConnectionInfo(ctx, clusterName, fluxNamespace, cli)
if err != nil {
return &pb.GetSessionLogsResponse{Error: err.Error()}, err
Expand All @@ -145,14 +153,7 @@ func (cs *coreServer) GetSessionLogs(ctx context.Context, msg *pb.GetSessionLogs
firstToken string
)

logSourceFilter := msg.GetLogSourceFilter()
if logSourceFilter == "" || logSourceFilter == logger.SessionLogSource {
// check if we can get session logs already
// if the secret is not created yet, we should not display an error in the browser console
if err = isSecretCreated(ctx, cli, constants.GitOpsRunNamespace, constants.RunDevBucketCredentials); err != nil {
return &pb.GetSessionLogsResponse{Error: secretNotFound}, nil
}

if isLoadingGitOpsRunLogs {
// get gitops-run logs
gitopsRunLogs, token, err := getGitOpsRunLogs(
ctx,
Expand Down

0 comments on commit 9103dea

Please sign in to comment.