Skip to content

Commit 00f8d32

Browse files
committed
add not found debug out for check cmd; update usage
Signed-off-by: Mike Brown <[email protected]>
1 parent 5b1bbb2 commit 00f8d32

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

cmd/ctr/commands/images/images.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,9 @@ var setLabelsCommand = cli.Command{
199199

200200
var checkCommand = cli.Command{
201201
Name: "check",
202-
Usage: "check that an image has all content available locally",
202+
Usage: "check existing images to ensure all content is available locally",
203203
ArgsUsage: "[flags] [<filter>, ...]",
204-
Description: "check that an image has all content available locally",
204+
Description: "check existing images to ensure all content is available locally",
205205
Flags: commands.SnapshotterFlags,
206206
Action: func(context *cli.Context) error {
207207
var (
@@ -212,17 +212,21 @@ var checkCommand = cli.Command{
212212
return err
213213
}
214214
defer cancel()
215-
var (
216-
contentStore = client.ContentStore()
217-
tw = tabwriter.NewWriter(os.Stdout, 1, 8, 1, ' ', 0)
218-
)
219-
fmt.Fprintln(tw, "REF\tTYPE\tDIGEST\tSTATUS\tSIZE\tUNPACKED\t")
215+
216+
var contentStore = client.ContentStore()
220217

221218
args := []string(context.Args())
222219
imageList, err := client.ListImages(ctx, args...)
223220
if err != nil {
224221
return errors.Wrap(err, "failed listing images")
225222
}
223+
if len(imageList) == 0 {
224+
log.G(ctx).Debugf("no images found")
225+
return exitErr
226+
}
227+
228+
var tw = tabwriter.NewWriter(os.Stdout, 1, 8, 1, ' ', 0)
229+
fmt.Fprintln(tw, "REF\tTYPE\tDIGEST\tSTATUS\tSIZE\tUNPACKED\t")
226230

227231
for _, image := range imageList {
228232
var (

0 commit comments

Comments
 (0)