(ctx context.Context, volumes []string, options types.VolumeInspectOptions)
| 27 | ) |
| 28 | |
| 29 | func 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 | } |
no test coverage detected
searching dependent graphs…