MCPcopy Create free account
hub / github.com/containerd/nerdctl / Inspect

Function Inspect

pkg/cmd/volume/inspect.go:29–57  ·  view source on GitHub ↗
(ctx context.Context, volumes []string, options types.VolumeInspectOptions)

Source from the content-addressed store, hash-verified

27)
28
29func Inspect(ctx context.Context, volumes []string, options types.VolumeInspectOptions) error {
30 volStore, err := Store(options.GOptions.Namespace, options.GOptions.DataRoot, options.GOptions.Address)
31 if err != nil {
32 return err
33 }
34 result := []interface{}{}
35
36 warns := []error{}
37 for _, name := range volumes {
38 var vol, err = volStore.Get(name, options.Size)
39 if err != nil {
40 warns = append(warns, err)
41 continue
42 }
43 result = append(result, vol)
44 }
45 err = formatter.FormatSlice(options.Format, options.Stdout, result)
46 if err != nil {
47 return err
48 }
49 for _, warn := range warns {
50 log.G(ctx).Warn(warn)
51 }
52
53 if len(warns) != 0 {
54 return errors.New("some volumes could not be inspected")
55 }
56 return nil
57}

Callers 1

inspectActionFunction · 0.92

Calls 3

FormatSliceFunction · 0.92
StoreFunction · 0.70
GetMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…