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

Function Inspect

pkg/cmd/namespace/inspect.go:31–59  ·  view source on GitHub ↗
(ctx context.Context, client *containerd.Client, inspectedNamespaces []string, options types.NamespaceInspectOptions)

Source from the content-addressed store, hash-verified

29)
30
31func Inspect(ctx context.Context, client *containerd.Client, inspectedNamespaces []string, options types.NamespaceInspectOptions) error {
32 result := []interface{}{}
33 warns := []error{}
34
35 for _, ns := range inspectedNamespaces {
36 ctx = namespaces.WithNamespace(ctx, ns)
37 namespaceService := client.NamespaceService()
38 if err := namespaceExists(ctx, namespaceService, ns); err != nil {
39 warns = append(warns, err)
40 continue
41 }
42 labels, err := namespaceService.Labels(ctx, ns)
43 if err != nil {
44 return err
45 }
46 nsInspect := native.Namespace{
47 Name: ns,
48 Labels: &labels,
49 }
50 result = append(result, nsInspect)
51 }
52 if err := formatter.FormatSlice(options.Format, options.Stdout, result); err != nil {
53 return err
54 }
55 for _, warn := range warns {
56 log.G(ctx).Warn(warn)
57 }
58 return nil
59}

Callers 1

inspectActionFunction · 0.92

Calls 3

FormatSliceFunction · 0.92
namespaceExistsFunction · 0.85
LabelsMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…