Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.10] Flush repo after policy is set #6890

Merged
merged 1 commit into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelogs/unreleased/6890-Lyndon-Li
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Flush repo after policy is set so that policy is retrieved correctly by TreeForSource
6 changes: 5 additions & 1 deletion pkg/uploader/kopia/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@
return "", 0, errors.Wrapf(err, "unable to set policy for si %v", sourceInfo)
}

if err := rep.Flush(ctx); err != nil {
return "", 0, errors.Wrap(err, "error to flush policy repo")
}

policyTree, err := treeForSourceFunc(ctx, rep, sourceInfo)
if err != nil {
return "", 0, errors.Wrapf(err, "unable to create policy getter for si %v", sourceInfo)
Expand Down Expand Up @@ -232,7 +236,7 @@
var errs []string
if ds := manifest.RootEntry.DirSummary; ds != nil {
for _, ent := range ds.FailedEntries {
policy := policyTree.DefinedPolicy()
policy := policyTree.EffectivePolicy()

Check warning on line 239 in pkg/uploader/kopia/snapshot.go

View check run for this annotation

Codecov / codecov/patch

pkg/uploader/kopia/snapshot.go#L239

Added line #L239 was not covered by tests
if !(policy != nil && *policy.ErrorHandlingPolicy.IgnoreUnknownTypes == true && strings.Contains(ent.Error, fs.ErrUnknown.Error())) {
errs = append(errs, fmt.Sprintf("Error when processing %v: %v", ent.EntryPath, ent.Error))
}
Expand Down
Loading