Skip to content

Commit c74c4dc

Browse files
committed
review comments update
1 parent ff2ae47 commit c74c4dc

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

internal/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1622,6 +1622,7 @@ func resolveExternalDataSource() *ExternalDataSource {
16221622
}
16231623

16241624
if err := validateAllowedDomains(externalDataSource.AllowedDomains); err != nil {
1625+
slog.Error("External data source not configured due to invalid configuration", "error", err)
16251626
return nil
16261627
}
16271628

@@ -1636,7 +1637,6 @@ func validateAllowedDomains(domains []string) error {
16361637
for _, domain := range domains {
16371638
// Validating syntax using the RFC-compliant regex
16381639
if !domainRegex.MatchString(domain) || domain == "" {
1639-
slog.Error("domain specified in allowed_domains is invalid", "domain", domain)
16401640
return errors.New("invalid domain found in allowed_domains")
16411641
}
16421642
}

internal/file/external_file_operator.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func (efo *ExternalFileOperator) DownloadExternalFile(ctx context.Context, fileA
4545
permission := fileAction.File.GetFileMeta().GetPermissions()
4646
fileName := fileAction.File.GetFileMeta().GetName()
4747

48-
slog.InfoContext(ctx, "Downloading external file from", "location", location)
48+
slog.InfoContext(ctx, "Downloading external file", "location", location)
4949

5050
var contentToWrite []byte
5151
var downloadErr, updateError error
@@ -150,7 +150,8 @@ func (efo *ExternalFileOperator) downloadFileContent(ctx context.Context, file *
150150
headers.ETag = resp.Header.Get("ETag")
151151
headers.LastModified = resp.Header.Get("Last-Modified")
152152
case http.StatusNotModified:
153-
slog.DebugContext(ctx, "File content unchanged (304 Not Modified)", "file_name", fileName)
153+
slog.InfoContext(ctx, "Received 304 status code in response from external data source, "+
154+
"file has not been modified", "file_name", fileName)
154155
// return empty content but preserve headers if present
155156
header := DownloadHeader{
156157
ETag: resp.Header.Get("ETag"),

internal/file/file_manager_service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ actionsLoop:
703703
tempFilePath := tempFilePath(fileMeta.GetName())
704704
switch fileAction.Action {
705705
case model.Delete:
706-
slog.DebugContext(ctx, "Deleting file", "file", fileMeta.GetName())
706+
slog.InfoContext(ctx, "Deleting file", "file", fileMeta.GetName())
707707
if err = os.Remove(fileMeta.GetName()); err != nil && !os.IsNotExist(err) {
708708
actionError = fmt.Errorf("error deleting file: %s error: %w",
709709
fileMeta.GetName(), err)

internal/file/file_plugin.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package file
77

88
import (
99
"context"
10+
"errors"
1011
"fmt"
1112
"log/slog"
1213
"sync"
@@ -352,14 +353,16 @@ func (fp *FilePlugin) handleConfigApplyRequest(ctx context.Context, msg *bus.Mes
352353
if rollbackErr != nil {
353354
// include both the original apply error and the rollback error so the management plane
354355
// receives actionable information about what failed during apply and what failed during rollback
355-
combinedErr := fmt.Sprintf("apply error: %s; rollback error: %s", err.Error(), rollbackErr.Error())
356+
applyErr := fmt.Errorf("config apply error: %w", err)
357+
rbErr := fmt.Errorf("rollback error: %w", rollbackErr)
358+
combinedErr := errors.Join(applyErr, rbErr)
356359

357360
rollbackResponse := fp.createDataPlaneResponse(
358361
correlationID,
359362
mpi.CommandResponse_COMMAND_STATUS_FAILURE,
360363
"Config apply failed, rollback failed",
361364
instanceID,
362-
combinedErr,
365+
combinedErr.Error(),
363366
)
364367

365368
fp.messagePipe.Process(ctx, &bus.Message{Topic: bus.ConfigApplyCompleteTopic, Data: rollbackResponse})

0 commit comments

Comments
 (0)