MCPcopy
hub / github.com/kopia/kopia / migrateAllPolicies

Method migrateAllPolicies

cli/command_snapshot_migrate.go:171–184  ·  view source on GitHub ↗
(ctx context.Context, sourceRepo repo.Repository, destRepo repo.RepositoryWriter)

Source from the content-addressed store, hash-verified

169}
170
171func (c *commandSnapshotMigrate) migrateAllPolicies(ctx context.Context, sourceRepo repo.Repository, destRepo repo.RepositoryWriter) error {
172 policies, err := policy.ListPolicies(ctx, sourceRepo)
173 if err != nil {
174 return errors.Wrap(err, "unable to list source policies")
175 }
176
177 for _, pol := range policies {
178 if err := c.migrateSinglePolicy(ctx, sourceRepo, destRepo, pol.Target()); err != nil {
179 log(ctx).Errorf("unable to migrate policy for %v: %v", pol.Target(), err)
180 }
181 }
182
183 return nil
184}
185
186func (c *commandSnapshotMigrate) migrateSinglePolicy(ctx context.Context, sourceRepo repo.Repository, destRepo repo.RepositoryWriter, si snapshot.SourceInfo) error {
187 pol, err := policy.GetDefinedPolicy(ctx, sourceRepo, si)

Callers 1

runMethod · 0.95

Calls 4

migrateSinglePolicyMethod · 0.95
ListPoliciesFunction · 0.92
TargetMethod · 0.80
ErrorfMethod · 0.80

Tested by

no test coverage detected