(ctx context.Context, rep repo.Repository)
| 206 | } |
| 207 | |
| 208 | func (c *commandSnapshotVerify) loadSourceManifests(ctx context.Context, rep repo.Repository) ([]*snapshot.Manifest, error) { |
| 209 | var manifestIDs []manifest.ID |
| 210 | |
| 211 | if c.noVerifyTargetArgsProvided() { |
| 212 | // User didn't specify any particular snapshot or snapshots to verify. |
| 213 | // Read out all manifests and verify everything. |
| 214 | man, err := snapshot.ListSnapshotManifests(ctx, rep, nil, nil) |
| 215 | if err != nil { |
| 216 | return nil, errors.Wrap(err, "unable to list snapshot manifests") |
| 217 | } |
| 218 | |
| 219 | manifestIDs = append(manifestIDs, man...) |
| 220 | } else { |
| 221 | for _, srcStr := range c.verifyCommandSources { |
| 222 | src, err := snapshot.ParseSourceInfo(srcStr, rep.ClientOptions().Hostname, rep.ClientOptions().Username) |
| 223 | if err != nil { |
| 224 | return nil, errors.Wrapf(err, "error parsing %q", srcStr) |
| 225 | } |
| 226 | |
| 227 | man, err := snapshot.ListSnapshotManifests(ctx, rep, &src, nil) |
| 228 | if err != nil { |
| 229 | return nil, errors.Wrapf(err, "unable to list snapshot manifests for %v", src) |
| 230 | } |
| 231 | |
| 232 | manifestIDs = append(manifestIDs, man...) |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | //nolint:wrapcheck |
| 237 | return snapshot.LoadSnapshots(ctx, rep, manifestIDs) |
| 238 | } |
| 239 | |
| 240 | // noVerifyTargetArgsProvided will return true if the user didn't specify any |
| 241 | // particular snapshots to be verified, by any of the available means. |
no test coverage detected