()
| 30 | ) |
| 31 | |
| 32 | func init() { |
| 33 | registry.Register(&plugin.Registration{ |
| 34 | Type: plugins.SnapshotPlugin, |
| 35 | ID: "devmapper", |
| 36 | Config: &devmapper.Config{}, |
| 37 | InitFn: func(ic *plugin.InitContext) (any, error) { |
| 38 | ic.Meta.Platforms = append(ic.Meta.Platforms, platforms.DefaultSpec()) |
| 39 | |
| 40 | config, ok := ic.Config.(*devmapper.Config) |
| 41 | if !ok { |
| 42 | return nil, errors.New("invalid devmapper configuration") |
| 43 | } |
| 44 | |
| 45 | if config.PoolName == "" { |
| 46 | return nil, fmt.Errorf("devmapper not configured: %w", plugin.ErrSkipPlugin) |
| 47 | } |
| 48 | |
| 49 | if config.RootPath == "" { |
| 50 | config.RootPath = ic.Properties[plugins.PropertyRootDir] |
| 51 | } |
| 52 | |
| 53 | ic.Meta.Exports[plugins.SnapshotterRootDir] = config.RootPath |
| 54 | return devmapper.NewSnapshotter(ic.Context, config) |
| 55 | }, |
| 56 | }) |
| 57 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…