summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/common/completion.go65
-rw-r--r--cmd/podman/common/completion_test.go12
-rw-r--r--cmd/podman/common/create_test.go4
-rw-r--r--cmd/podman/common/inspect.go16
-rw-r--r--cmd/podman/containers/inspect.go2
-rw-r--r--cmd/podman/containers/kill.go2
-rw-r--r--cmd/podman/containers/rm.go2
-rw-r--r--cmd/podman/containers/stop.go2
-rw-r--r--cmd/podman/images/inspect.go2
-rw-r--r--cmd/podman/images/save.go5
-rw-r--r--cmd/podman/inspect/inspect.go51
-rw-r--r--cmd/podman/machine/machine.go2
-rw-r--r--cmd/podman/machine/machine_unix.go12
-rw-r--r--cmd/podman/machine/machine_windows.go11
-rw-r--r--cmd/podman/networks/inspect.go2
-rw-r--r--cmd/podman/play/kube.go9
-rw-r--r--cmd/podman/volumes/export.go3
-rw-r--r--cmd/podman/volumes/import.go3
-rw-r--r--cmd/podman/volumes/inspect.go2
19 files changed, 129 insertions, 78 deletions
diff --git a/cmd/podman/common/completion.go b/cmd/podman/common/completion.go
index 6149a4465..58dff3578 100644
--- a/cmd/podman/common/completion.go
+++ b/cmd/podman/common/completion.go
@@ -12,6 +12,7 @@ import (
"github.com/containers/image/v5/pkg/sysregistriesv2"
"github.com/containers/podman/v4/cmd/podman/registry"
"github.com/containers/podman/v4/libpod/define"
+ "github.com/containers/podman/v4/libpod/events"
"github.com/containers/podman/v4/pkg/domain/entities"
"github.com/containers/podman/v4/pkg/rootless"
systemdDefine "github.com/containers/podman/v4/pkg/systemd/define"
@@ -24,6 +25,8 @@ var (
ChangeCmds = []string{"CMD", "ENTRYPOINT", "ENV", "EXPOSE", "LABEL", "ONBUILD", "STOPSIGNAL", "USER", "VOLUME", "WORKDIR"}
// LogLevels supported by podman
LogLevels = []string{"trace", "debug", "info", "warn", "warning", "error", "fatal", "panic"}
+ // ValidSaveFormats is the list of support podman save formats
+ ValidSaveFormats = []string{define.OCIManifestDir, define.OCIArchive, define.V2s2ManifestDir, define.V2s2Archive}
)
type completeType int
@@ -992,13 +995,6 @@ func AutocompleteFormat(o interface{}) func(cmd *cobra.Command, args []string, t
fields := strings.Split(field[len(field)-1], ".")
f := reflect.ValueOf(o)
for i := 1; i < len(fields); i++ {
- val := getActualStructType(f)
- if val == nil {
- // no struct return nothing to complete
- return nil, cobra.ShellCompDirectiveNoFileComp
- }
- f = *val
-
// last field get all names to suggest
if i == len(fields)-1 {
suggestions := getStructFields(f, fields[i])
@@ -1008,6 +1004,14 @@ func AutocompleteFormat(o interface{}) func(cmd *cobra.Command, args []string, t
toComplete = strings.Join(toCompArr, ".")
return prefixSlice(toComplete, suggestions), cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp
}
+
+ val := getActualStructType(f)
+ if val == nil {
+ // no struct return nothing to complete
+ return nil, cobra.ShellCompDirectiveNoFileComp
+ }
+ f = *val
+
// set the next struct field
f = f.FieldByName(fields[i])
}
@@ -1038,12 +1042,15 @@ func getActualStructType(f reflect.Value) *reflect.Value {
// getStructFields reads all struct field names and method names and returns them.
func getStructFields(f reflect.Value, prefix string) []string {
- suggestions := []string{}
+ var suggestions []string
+ if f.IsValid() {
+ suggestions = append(suggestions, getMethodNames(f, prefix)...)
+ }
val := getActualStructType(f)
if val == nil {
// no struct return nothing to complete
- return nil
+ return suggestions
}
f = *val
@@ -1069,7 +1076,11 @@ func getStructFields(f reflect.Value, prefix string) []string {
suggestions = append(suggestions, fname+suffix)
}
}
+ return suggestions
+}
+func getMethodNames(f reflect.Value, prefix string) []string {
+ suggestions := make([]string, 0, f.NumMethod())
for j := 0; j < f.NumMethod(); j++ {
fname := f.Type().Method(j).Name
if strings.HasPrefix(fname, prefix) {
@@ -1077,18 +1088,27 @@ func getStructFields(f reflect.Value, prefix string) []string {
suggestions = append(suggestions, fname+"}}")
}
}
-
return suggestions
}
// AutocompleteEventFilter - Autocomplete event filter flag options.
// -> "container=", "event=", "image=", "pod=", "volume=", "type="
func AutocompleteEventFilter(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
+ event := func(_ string) ([]string, cobra.ShellCompDirective) {
+ return []string{events.Attach.String(), events.AutoUpdate.String(), events.Checkpoint.String(), events.Cleanup.String(),
+ events.Commit.String(), events.Create.String(), events.Exec.String(), events.ExecDied.String(),
+ events.Exited.String(), events.Export.String(), events.Import.String(), events.Init.String(), events.Kill.String(),
+ events.LoadFromArchive.String(), events.Mount.String(), events.NetworkConnect.String(),
+ events.NetworkDisconnect.String(), events.Pause.String(), events.Prune.String(), events.Pull.String(),
+ events.Push.String(), events.Refresh.String(), events.Remove.String(), events.Rename.String(),
+ events.Renumber.String(), events.Restart.String(), events.Restore.String(), events.Save.String(),
+ events.Start.String(), events.Stop.String(), events.Sync.String(), events.Tag.String(), events.Unmount.String(),
+ events.Unpause.String(), events.Untag.String(),
+ }, cobra.ShellCompDirectiveNoFileComp
+ }
eventTypes := func(_ string) ([]string, cobra.ShellCompDirective) {
- return []string{"attach", "checkpoint", "cleanup", "commit", "connect", "create", "disconnect", "exec",
- "exec_died", "exited", "export", "import", "init", "kill", "loadFromArchive", "mount", "pause",
- "prune", "pull", "push", "refresh", "remove", "rename", "renumber", "restart", "restore", "save",
- "start", "stop", "sync", "tag", "unmount", "unpause", "untag",
+ return []string{events.Container.String(), events.Image.String(), events.Network.String(),
+ events.Pod.String(), events.System.String(), events.Volume.String(),
}, cobra.ShellCompDirectiveNoFileComp
}
kv := keyValueCompletion{
@@ -1096,7 +1116,7 @@ func AutocompleteEventFilter(cmd *cobra.Command, args []string, toComplete strin
"image=": func(s string) ([]string, cobra.ShellCompDirective) { return getImages(cmd, s) },
"pod=": func(s string) ([]string, cobra.ShellCompDirective) { return getPods(cmd, s, completeDefault) },
"volume=": func(s string) ([]string, cobra.ShellCompDirective) { return getVolumes(cmd, s) },
- "event=": eventTypes,
+ "event=": event,
"type=": eventTypes,
}
return completeKeyValues(toComplete, kv)
@@ -1123,9 +1143,8 @@ func AutocompleteImageSort(cmd *cobra.Command, args []string, toComplete string)
}
// AutocompleteInspectType - Autocomplete inspect type options.
-// -> "container", "image", "all"
func AutocompleteInspectType(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
- types := []string{"container", "image", "all"}
+ types := []string{AllType, ContainerType, ImageType, NetworkType, PodType, VolumeType}
return types, cobra.ShellCompDirectiveNoFileComp
}
@@ -1175,10 +1194,8 @@ func AutocompletePsSort(cmd *cobra.Command, args []string, toComplete string) ([
}
// AutocompleteImageSaveFormat - Autocomplete image save format options.
-// -> "oci-archive", "oci-dir", "docker-dir"
func AutocompleteImageSaveFormat(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
- formats := []string{"oci-archive", "oci-dir", "docker-dir"}
- return formats, cobra.ShellCompDirectiveNoFileComp
+ return ValidSaveFormats, cobra.ShellCompDirectiveNoFileComp
}
// AutocompleteWaitCondition - Autocomplete wait condition options.
@@ -1191,21 +1208,21 @@ func AutocompleteWaitCondition(cmd *cobra.Command, args []string, toComplete str
// AutocompleteCgroupManager - Autocomplete cgroup manager options.
// -> "cgroupfs", "systemd"
func AutocompleteCgroupManager(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
- types := []string{"cgroupfs", "systemd"}
+ types := []string{config.CgroupfsCgroupsManager, config.SystemdCgroupsManager}
return types, cobra.ShellCompDirectiveNoFileComp
}
// AutocompleteEventBackend - Autocomplete event backend options.
// -> "file", "journald", "none"
func AutocompleteEventBackend(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
- types := []string{"file", "journald", "none"}
+ types := []string{events.LogFile.String(), events.Journald.String(), events.Null.String()}
return types, cobra.ShellCompDirectiveNoFileComp
}
// AutocompleteNetworkBackend - Autocomplete network backend options.
// -> "cni", "netavark"
func AutocompleteNetworkBackend(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
- types := []string{"cni", "netavark"}
+ types := []string{string(types.CNI), string(types.Netavark)}
return types, cobra.ShellCompDirectiveNoFileComp
}
@@ -1218,7 +1235,7 @@ func AutocompleteLogLevel(cmd *cobra.Command, args []string, toComplete string)
// AutocompleteSDNotify - Autocomplete sdnotify options.
// -> "container", "conmon", "ignore"
func AutocompleteSDNotify(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
- types := []string{"container", "conmon", "ignore"}
+ types := []string{define.SdNotifyModeContainer, define.SdNotifyModeContainer, define.SdNotifyModeIgnore}
return types, cobra.ShellCompDirectiveNoFileComp
}
diff --git a/cmd/podman/common/completion_test.go b/cmd/podman/common/completion_test.go
index ae117a173..13f45a662 100644
--- a/cmd/podman/common/completion_test.go
+++ b/cmd/podman/common/completion_test.go
@@ -25,7 +25,9 @@ func (c Car) Type() string {
return ""
}
-func (c Car) Color() string {
+// Note: It is important that this function is *Car and the Type one is just Car.
+// The reflect logic behaves differently for these cases so we have to test both.
+func (c *Car) Color() string {
return ""
}
@@ -94,7 +96,7 @@ func TestAutocompleteFormat(t *testing.T) {
{
"second level struct field name",
"{{ .Car.",
- []string{"{{ .Car.Brand}}", "{{ .Car.Stats.", "{{ .Car.Extras}}", "{{ .Car.Color}}", "{{ .Car.Type}}"},
+ []string{"{{ .Car.Color}}", "{{ .Car.Type}}", "{{ .Car.Brand}}", "{{ .Car.Stats.", "{{ .Car.Extras}}"},
},
{
"second level struct field name",
@@ -104,7 +106,7 @@ func TestAutocompleteFormat(t *testing.T) {
{
"second level nil struct field name",
"{{ .Car2.",
- []string{"{{ .Car2.Brand}}", "{{ .Car2.Stats.", "{{ .Car2.Extras}}", "{{ .Car2.Color}}", "{{ .Car2.Type}}"},
+ []string{"{{ .Car2.Color}}", "{{ .Car2.Type}}", "{{ .Car2.Brand}}", "{{ .Car2.Stats.", "{{ .Car2.Extras}}"},
},
{
"three level struct field name",
@@ -134,8 +136,8 @@ func TestAutocompleteFormat(t *testing.T) {
{
"two variables struct field name",
"{{ .Car.Brand }} {{ .Car.",
- []string{"{{ .Car.Brand }} {{ .Car.Brand}}", "{{ .Car.Brand }} {{ .Car.Stats.", "{{ .Car.Brand }} {{ .Car.Extras}}",
- "{{ .Car.Brand }} {{ .Car.Color}}", "{{ .Car.Brand }} {{ .Car.Type}}"},
+ []string{"{{ .Car.Brand }} {{ .Car.Color}}", "{{ .Car.Brand }} {{ .Car.Type}}", "{{ .Car.Brand }} {{ .Car.Brand}}",
+ "{{ .Car.Brand }} {{ .Car.Stats.", "{{ .Car.Brand }} {{ .Car.Extras}}"},
},
{
"only dot without variable",
diff --git a/cmd/podman/common/create_test.go b/cmd/podman/common/create_test.go
index ab41f81ad..80e6cbf54 100644
--- a/cmd/podman/common/create_test.go
+++ b/cmd/podman/common/create_test.go
@@ -28,8 +28,8 @@ func TestPodOptions(t *testing.T) {
for j := 0; j < cc.NumField(); j++ {
containerField := cc.FieldByIndex([]int{j})
containerType := reflect.TypeOf(exampleOptions).Field(j)
- tagPod := strings.Split(string(podType.Tag.Get("json")), ",")[0]
- tagContainer := strings.Split(string(containerType.Tag.Get("json")), ",")[0]
+ tagPod := strings.Split(podType.Tag.Get("json"), ",")[0]
+ tagContainer := strings.Split(containerType.Tag.Get("json"), ",")[0]
if tagPod == tagContainer && (tagPod != "" && tagContainer != "") {
areEqual := true
if containerField.Kind() == podField.Kind() {
diff --git a/cmd/podman/common/inspect.go b/cmd/podman/common/inspect.go
new file mode 100644
index 000000000..12a5af5a9
--- /dev/null
+++ b/cmd/podman/common/inspect.go
@@ -0,0 +1,16 @@
+package common
+
+const (
+ // AllType can be of type ImageType or ContainerType.
+ AllType = "all"
+ // ContainerType is the container type.
+ ContainerType = "container"
+ // ImageType is the image type.
+ ImageType = "image"
+ // NetworkType is the network type
+ NetworkType = "network"
+ // PodType is the pod type.
+ PodType = "pod"
+ // VolumeType is the volume type
+ VolumeType = "volume"
+)
diff --git a/cmd/podman/containers/inspect.go b/cmd/podman/containers/inspect.go
index 03e6411a1..4195cf020 100644
--- a/cmd/podman/containers/inspect.go
+++ b/cmd/podman/containers/inspect.go
@@ -42,6 +42,6 @@ func init() {
func inspectExec(cmd *cobra.Command, args []string) error {
// Force container type
- inspectOpts.Type = inspect.ContainerType
+ inspectOpts.Type = common.ContainerType
return inspect.Inspect(args, *inspectOpts)
}
diff --git a/cmd/podman/containers/kill.go b/cmd/podman/containers/kill.go
index 32f9899cd..e994fbf2c 100644
--- a/cmd/podman/containers/kill.go
+++ b/cmd/podman/containers/kill.go
@@ -95,7 +95,7 @@ func kill(_ *cobra.Command, args []string) error {
return errors.New("valid signals are 1 through 64")
}
for _, cidFile := range cidFiles {
- content, err := ioutil.ReadFile(string(cidFile))
+ content, err := ioutil.ReadFile(cidFile)
if err != nil {
return errors.Wrap(err, "error reading CIDFile")
}
diff --git a/cmd/podman/containers/rm.go b/cmd/podman/containers/rm.go
index 7e0955863..420e3c38d 100644
--- a/cmd/podman/containers/rm.go
+++ b/cmd/podman/containers/rm.go
@@ -102,7 +102,7 @@ func rm(cmd *cobra.Command, args []string) error {
rmOptions.Timeout = &stopTimeout
}
for _, cidFile := range cidFiles {
- content, err := ioutil.ReadFile(string(cidFile))
+ content, err := ioutil.ReadFile(cidFile)
if err != nil {
return errors.Wrap(err, "error reading CIDFile")
}
diff --git a/cmd/podman/containers/stop.go b/cmd/podman/containers/stop.go
index 381997fee..af2250abb 100644
--- a/cmd/podman/containers/stop.go
+++ b/cmd/podman/containers/stop.go
@@ -100,7 +100,7 @@ func stop(cmd *cobra.Command, args []string) error {
}
for _, cidFile := range cidFiles {
- content, err := ioutil.ReadFile(string(cidFile))
+ content, err := ioutil.ReadFile(cidFile)
if err != nil {
return errors.Wrap(err, "error reading CIDFile")
}
diff --git a/cmd/podman/images/inspect.go b/cmd/podman/images/inspect.go
index 22c404b3f..310f8cda8 100644
--- a/cmd/podman/images/inspect.go
+++ b/cmd/podman/images/inspect.go
@@ -38,6 +38,6 @@ func init() {
}
func inspectExec(cmd *cobra.Command, args []string) error {
- inspectOpts.Type = inspect.ImageType
+ inspectOpts.Type = common.ImageType
return inspect.Inspect(args, *inspectOpts)
}
diff --git a/cmd/podman/images/save.go b/cmd/podman/images/save.go
index fb642bafd..3394c2e99 100644
--- a/cmd/podman/images/save.go
+++ b/cmd/podman/images/save.go
@@ -18,7 +18,6 @@ import (
)
var (
- validFormats = []string{define.OCIManifestDir, define.OCIArchive, define.V2s2ManifestDir, define.V2s2Archive}
containerConfig = registry.PodmanConfig()
)
@@ -38,8 +37,8 @@ var (
if err != nil {
return err
}
- if !util.StringInSlice(format, validFormats) {
- return errors.Errorf("format value must be one of %s", strings.Join(validFormats, " "))
+ if !util.StringInSlice(format, common.ValidSaveFormats) {
+ return errors.Errorf("format value must be one of %s", strings.Join(common.ValidSaveFormats, " "))
}
return nil
},
diff --git a/cmd/podman/inspect/inspect.go b/cmd/podman/inspect/inspect.go
index b26b2d667..f6e3fca06 100644
--- a/cmd/podman/inspect/inspect.go
+++ b/cmd/podman/inspect/inspect.go
@@ -21,21 +21,6 @@ import (
"github.com/spf13/cobra"
)
-const (
- // AllType can be of type ImageType or ContainerType.
- AllType = "all"
- // ContainerType is the container type.
- ContainerType = "container"
- // ImageType is the image type.
- ImageType = "image"
- // NetworkType is the network type
- NetworkType = "network"
- // PodType is the pod type.
- PodType = "pod"
- // VolumeType is the volume type
- VolumeType = "volume"
-)
-
// AddInspectFlagSet takes a command and adds the inspect flags and returns an
// InspectOptions object.
func AddInspectFlagSet(cmd *cobra.Command) *entities.InspectOptions {
@@ -49,7 +34,7 @@ func AddInspectFlagSet(cmd *cobra.Command) *entities.InspectOptions {
_ = cmd.RegisterFlagCompletionFunc(formatFlagName, completion.AutocompleteNone)
typeFlagName := "type"
- flags.StringVarP(&opts.Type, typeFlagName, "t", AllType, fmt.Sprintf("Specify inspect-object type (%q, %q or %q)", ImageType, ContainerType, AllType))
+ flags.StringVarP(&opts.Type, typeFlagName, "t", common.AllType, "Specify inspect-object type")
_ = cmd.RegisterFlagCompletionFunc(typeFlagName, common.AutocompleteInspectType)
validate.AddLatestFlag(cmd, &opts.Latest)
@@ -76,21 +61,22 @@ type inspector struct {
// newInspector creates a new inspector based on the specified options.
func newInspector(options entities.InspectOptions) (*inspector, error) {
switch options.Type {
- case ImageType, ContainerType, AllType, PodType, NetworkType, VolumeType:
+ case common.ImageType, common.ContainerType, common.AllType, common.PodType, common.NetworkType, common.VolumeType:
// Valid types.
default:
- return nil, errors.Errorf("invalid type %q: must be %q, %q, %q, %q, %q, or %q", options.Type, ImageType, ContainerType, PodType, NetworkType, VolumeType, AllType)
+ return nil, errors.Errorf("invalid type %q: must be %q, %q, %q, %q, %q, or %q", options.Type,
+ common.ImageType, common.ContainerType, common.PodType, common.NetworkType, common.VolumeType, common.AllType)
}
- if options.Type == ImageType {
+ if options.Type == common.ImageType {
if options.Latest {
- return nil, errors.Errorf("latest is not supported for type %q", ImageType)
+ return nil, errors.Errorf("latest is not supported for type %q", common.ImageType)
}
if options.Size {
- return nil, errors.Errorf("size is not supported for type %q", ImageType)
+ return nil, errors.Errorf("size is not supported for type %q", common.ImageType)
}
}
- if options.Type == PodType && options.Size {
- return nil, errors.Errorf("size is not supported for type %q", PodType)
+ if options.Type == common.PodType && options.Size {
+ return nil, errors.Errorf("size is not supported for type %q", common.PodType)
}
podOpts := entities.PodInspectOptions{
Latest: options.Latest,
@@ -122,21 +108,21 @@ func (i *inspector) inspect(namesOrIDs []string) error {
if len(namesOrIDs) > 0 {
return errors.New("--latest and arguments cannot be used together")
}
- if i.options.Type == AllType {
- tmpType = ContainerType // -l works with --type=all, defaults to containertype
+ if i.options.Type == common.AllType {
+ tmpType = common.ContainerType // -l works with --type=all, defaults to containertype
}
}
// Inspect - note that AllType requires us to expensively query one-by-one.
switch tmpType {
- case AllType:
+ case common.AllType:
allData, allErrs, err := i.inspectAll(ctx, namesOrIDs)
if err != nil {
return err
}
data = allData
errs = allErrs
- case ImageType:
+ case common.ImageType:
imgData, allErrs, err := i.imageEngine.Inspect(ctx, namesOrIDs, i.options)
if err != nil {
return err
@@ -145,7 +131,7 @@ func (i *inspector) inspect(namesOrIDs []string) error {
for i := range imgData {
data = append(data, imgData[i])
}
- case ContainerType:
+ case common.ContainerType:
ctrData, allErrs, err := i.containerEngine.ContainerInspect(ctx, namesOrIDs, i.options)
if err != nil {
return err
@@ -154,7 +140,7 @@ func (i *inspector) inspect(namesOrIDs []string) error {
for i := range ctrData {
data = append(data, ctrData[i])
}
- case PodType:
+ case common.PodType:
for _, pod := range namesOrIDs {
i.podOptions.NameOrID = pod
podData, err := i.containerEngine.PodInspect(ctx, i.podOptions)
@@ -184,7 +170,7 @@ func (i *inspector) inspect(namesOrIDs []string) error {
data = append(data, podData)
}
}
- case NetworkType:
+ case common.NetworkType:
networkData, allErrs, err := registry.ContainerEngine().NetworkInspect(ctx, namesOrIDs, i.options)
if err != nil {
return err
@@ -193,7 +179,7 @@ func (i *inspector) inspect(namesOrIDs []string) error {
for i := range networkData {
data = append(data, networkData[i])
}
- case VolumeType:
+ case common.VolumeType:
volumeData, allErrs, err := i.containerEngine.VolumeInspect(ctx, namesOrIDs, i.options)
if err != nil {
return err
@@ -203,7 +189,8 @@ func (i *inspector) inspect(namesOrIDs []string) error {
data = append(data, volumeData[i])
}
default:
- return errors.Errorf("invalid type %q: must be %q, %q, %q, %q, %q, or %q", i.options.Type, ImageType, ContainerType, PodType, NetworkType, VolumeType, AllType)
+ return errors.Errorf("invalid type %q: must be %q, %q, %q, %q, %q, or %q", i.options.Type,
+ common.ImageType, common.ContainerType, common.PodType, common.NetworkType, common.VolumeType, common.AllType)
}
// Always print an empty array
if data == nil {
diff --git a/cmd/podman/machine/machine.go b/cmd/podman/machine/machine.go
index 553f1ef7a..5a8a06b9d 100644
--- a/cmd/podman/machine/machine.go
+++ b/cmd/podman/machine/machine.go
@@ -115,7 +115,7 @@ func resolveEventSock() ([]string, error) {
return err
case info.IsDir():
return nil
- case info.Type() != os.ModeSocket:
+ case !isUnixSocket(info):
return nil
case !re.MatchString(info.Name()):
return nil
diff --git a/cmd/podman/machine/machine_unix.go b/cmd/podman/machine/machine_unix.go
new file mode 100644
index 000000000..b56d081ec
--- /dev/null
+++ b/cmd/podman/machine/machine_unix.go
@@ -0,0 +1,12 @@
+//go:build linux || aix || android || darwin || dragonfly || freebsd || hurd || illumos || ios || netbsd || openbsd || solaris
+// +build linux aix android darwin dragonfly freebsd hurd illumos ios netbsd openbsd solaris
+
+package machine
+
+import (
+ "os"
+)
+
+func isUnixSocket(file os.DirEntry) bool {
+ return file.Type()&os.ModeSocket != 0
+}
diff --git a/cmd/podman/machine/machine_windows.go b/cmd/podman/machine/machine_windows.go
new file mode 100644
index 000000000..ffd5d8827
--- /dev/null
+++ b/cmd/podman/machine/machine_windows.go
@@ -0,0 +1,11 @@
+package machine
+
+import (
+ "os"
+ "strings"
+)
+
+func isUnixSocket(file os.DirEntry) bool {
+ // Assume a socket on Windows, since sock mode is not supported yet https://github.com/golang/go/issues/33357
+ return !file.Type().IsDir() && strings.HasSuffix(file.Name(), ".sock")
+}
diff --git a/cmd/podman/networks/inspect.go b/cmd/podman/networks/inspect.go
index 8f39ec395..1a8444147 100644
--- a/cmd/podman/networks/inspect.go
+++ b/cmd/podman/networks/inspect.go
@@ -37,6 +37,6 @@ func init() {
}
func networkInspect(_ *cobra.Command, args []string) error {
- inspectOpts.Type = inspect.NetworkType
+ inspectOpts.Type = common.NetworkType
return inspect.Inspect(args, *inspectOpts)
}
diff --git a/cmd/podman/play/kube.go b/cmd/podman/play/kube.go
index 5fe059139..f5b121009 100644
--- a/cmd/podman/play/kube.go
+++ b/cmd/podman/play/kube.go
@@ -139,6 +139,15 @@ func init() {
flags.StringVar(&kubeOptions.ContextDir, contextDirFlagName, "", "Path to top level of context directory")
_ = kubeCmd.RegisterFlagCompletionFunc(contextDirFlagName, completion.AutocompleteDefault)
+ // NOTE: The service-container flag is marked as hidden as it
+ // is purely designed for running play-kube in systemd units.
+ // It is not something users should need to know or care about.
+ //
+ // Having a flag rather than an env variable is cleaner.
+ serviceFlagName := "service-container"
+ flags.BoolVar(&kubeOptions.ServiceContainer, serviceFlagName, false, "Starts a service container before all pods")
+ _ = flags.MarkHidden("service-container")
+
flags.StringVar(&kubeOptions.SignaturePolicy, "signature-policy", "", "`Pathname` of signature policy file (not usually used)")
_ = flags.MarkHidden("signature-policy")
diff --git a/cmd/podman/volumes/export.go b/cmd/podman/volumes/export.go
index 1011604de..5086323f9 100644
--- a/cmd/podman/volumes/export.go
+++ b/cmd/podman/volumes/export.go
@@ -6,7 +6,6 @@ import (
"github.com/containers/common/pkg/completion"
"github.com/containers/podman/v4/cmd/podman/common"
- "github.com/containers/podman/v4/cmd/podman/inspect"
"github.com/containers/podman/v4/cmd/podman/registry"
"github.com/containers/podman/v4/pkg/domain/entities"
"github.com/containers/podman/v4/utils"
@@ -58,7 +57,7 @@ func export(cmd *cobra.Command, args []string) error {
if cliExportOpts.Output == "" {
return errors.New("expects output path, use --output=[path]")
}
- inspectOpts.Type = inspect.VolumeType
+ inspectOpts.Type = common.VolumeType
volumeData, _, err := containerEngine.VolumeInspect(ctx, args, inspectOpts)
if err != nil {
return err
diff --git a/cmd/podman/volumes/import.go b/cmd/podman/volumes/import.go
index 9ff17e5b1..988c5536d 100644
--- a/cmd/podman/volumes/import.go
+++ b/cmd/podman/volumes/import.go
@@ -5,7 +5,6 @@ import (
"os"
"github.com/containers/podman/v4/cmd/podman/common"
- "github.com/containers/podman/v4/cmd/podman/inspect"
"github.com/containers/podman/v4/cmd/podman/parse"
"github.com/containers/podman/v4/cmd/podman/registry"
"github.com/containers/podman/v4/pkg/domain/entities"
@@ -60,7 +59,7 @@ func importVol(cmd *cobra.Command, args []string) error {
tarFile = os.Stdin
}
- inspectOpts.Type = inspect.VolumeType
+ inspectOpts.Type = common.VolumeType
volumeData, _, err := containerEngine.VolumeInspect(ctx, volumes, inspectOpts)
if err != nil {
return err
diff --git a/cmd/podman/volumes/inspect.go b/cmd/podman/volumes/inspect.go
index f21f9c233..7cf363f36 100644
--- a/cmd/podman/volumes/inspect.go
+++ b/cmd/podman/volumes/inspect.go
@@ -48,6 +48,6 @@ func volumeInspect(cmd *cobra.Command, args []string) error {
if (inspectOpts.All && len(args) > 0) || (!inspectOpts.All && len(args) < 1) {
return errors.New("provide one or more volume names or use --all")
}
- inspectOpts.Type = inspect.VolumeType
+ inspectOpts.Type = common.VolumeType
return inspect.Inspect(args, *inspectOpts)
}