Files
podman/test/testvol/util.go
Valentin Rothberg 7131c84723 fix build
PR containers/podman/pull/14449 had an outdated base.  Merging it broke
builds.

[NO NEW TESTS NEEDED]

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-07-01 14:20:31 +02:00

30 lines
668 B
Go

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, 0)
}