mirror of
https://github.com/containers/podman.git
synced 2026-07-11 07:45:16 -04:00
The podman module paths are moving from github.com/containers/podman to go.podman.io/podman. This will help with future mobility. Signed-off-by: Brent Baude <bbaude@redhat.com>
30 lines
666 B
Go
30 lines
666 B
Go
package main
|
|
|
|
import (
|
|
"path/filepath"
|
|
"strings"
|
|
|
|
"go.podman.io/podman/v6/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)
|
|
}
|