blob: b4961e0979543ee44e8066e679f0bedd832c81bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
package main
import (
"path/filepath"
"strings"
"github.com/containers/podman/v4/libpod/plugin"
)
const pluginSockDir = "/run/docker/plugins"
func getSocketPath(pathOrName string) string {
if filepath.IsAbs(pathOrName) {
return pathOrName
}
// only a name join it with the default path
return filepath.Join(pluginSockDir, pathOrName+".sock")
}
func getPluginName(pathOrName string) string {
return strings.TrimSuffix(filepath.Base(pathOrName), ".sock")
}
func getPlugin(sockNameOrPath string) (*plugin.VolumePlugin, error) {
path := getSocketPath(sockNameOrPath)
name := getPluginName(sockNameOrPath)
return plugin.GetVolumePlugin(name, path, nil, nil)
}
|