summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-09-30 08:35:07 -0400
committerGitHub <noreply@github.com>2021-09-30 08:35:07 -0400
commitd8bdbf5b66c860a73f5d4e301535c0ee40d8d719 (patch)
treeee5e4c6705632064406f49147d2e5fb51947d300 /cmd
parentf0ae84f5120f7ec8d2fc16c6ae9e52725b5d4958 (diff)
parent855746cc9258b85d390d68cd3c61ca0588dd0f8f (diff)
downloadpodman-d8bdbf5b66c860a73f5d4e301535c0ee40d8d719.tar.gz
podman-d8bdbf5b66c860a73f5d4e301535c0ee40d8d719.tar.bz2
podman-d8bdbf5b66c860a73f5d4e301535c0ee40d8d719.zip
Merge pull request #11792 from mheon/340_final
Backports + release notes for v3.4.0 final
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/common/completion.go7
-rw-r--r--cmd/podman/containers/ps.go4
-rw-r--r--cmd/podman/generate/generate.go2
-rw-r--r--cmd/podman/images/prune.go4
-rw-r--r--cmd/podman/machine/list.go23
-rw-r--r--cmd/podman/play/play.go2
-rw-r--r--cmd/podman/registry/config.go7
-rw-r--r--cmd/podman/root.go5
-rw-r--r--cmd/podman/system/prune.go6
9 files changed, 33 insertions, 27 deletions
diff --git a/cmd/podman/common/completion.go b/cmd/podman/common/completion.go
index e925fb4f1..04fb71c33 100644
--- a/cmd/podman/common/completion.go
+++ b/cmd/podman/common/completion.go
@@ -193,21 +193,14 @@ func getImages(cmd *cobra.Command, toComplete string) ([]string, cobra.ShellComp
} else {
// suggested "registry.fedoraproject.org/f29/httpd:latest" as
// - "registry.fedoraproject.org/f29/httpd:latest"
- // - "registry.fedoraproject.org/f29/httpd"
// - "f29/httpd:latest"
- // - "f29/httpd"
// - "httpd:latest"
- // - "httpd"
paths := strings.Split(repo, "/")
for i := range paths {
suggestionWithTag := strings.Join(paths[i:], "/")
if strings.HasPrefix(suggestionWithTag, toComplete) {
suggestions = append(suggestions, suggestionWithTag)
}
- suggestionWithoutTag := strings.SplitN(strings.SplitN(suggestionWithTag, ":", 2)[0], "@", 2)[0]
- if strings.HasPrefix(suggestionWithoutTag, toComplete) {
- suggestions = append(suggestions, suggestionWithoutTag)
- }
}
}
}
diff --git a/cmd/podman/containers/ps.go b/cmd/podman/containers/ps.go
index 2566c57de..920ad0d4a 100644
--- a/cmd/podman/containers/ps.go
+++ b/cmd/podman/containers/ps.go
@@ -375,6 +375,10 @@ func (l psReporter) State() string {
// Status is a synonym for State()
func (l psReporter) Status() string {
+ hc := l.ListContainer.Status
+ if hc != "" {
+ return l.State() + " (" + hc + ")"
+ }
return l.State()
}
diff --git a/cmd/podman/generate/generate.go b/cmd/podman/generate/generate.go
index 6b48a342e..a42aa9f21 100644
--- a/cmd/podman/generate/generate.go
+++ b/cmd/podman/generate/generate.go
@@ -11,7 +11,7 @@ var (
// Command: podman _generate_
generateCmd = &cobra.Command{
Use: "generate",
- Short: "Generate structured data based on containers, pods or volumes.",
+ Short: "Generate structured data based on containers, pods or volumes",
Long: "Generate structured data (e.g., Kubernetes YAML or systemd units) based on containers, pods or volumes.",
RunE: validate.SubCommandExists,
}
diff --git a/cmd/podman/images/prune.go b/cmd/podman/images/prune.go
index 8a484495a..7e6a29d94 100644
--- a/cmd/podman/images/prune.go
+++ b/cmd/podman/images/prune.go
@@ -80,7 +80,7 @@ func prune(cmd *cobra.Command, args []string) error {
func createPruneWarningMessage(pruneOpts entities.ImagePruneOptions) string {
question := "Are you sure you want to continue? [y/N] "
if pruneOpts.All {
- return "WARNING! This will remove all images without at least one container associated to them.\n" + question
+ return "WARNING! This command removes all images without at least one container associated with them.\n" + question
}
- return "WARNING! This will remove all dangling images.\n" + question
+ return "WARNING! This command removes all dangling images.\n" + question
}
diff --git a/cmd/podman/machine/list.go b/cmd/podman/machine/list.go
index d4360bb9b..fe9d712e3 100644
--- a/cmd/podman/machine/list.go
+++ b/cmd/podman/machine/list.go
@@ -40,10 +40,13 @@ type listFlagType struct {
}
type machineReporter struct {
- Name string
- Created string
- LastUp string
- VMType string
+ Name string
+ Created string
+ LastUp string
+ VMType string
+ CPUs uint64
+ Memory string
+ DiskSize string
}
func init() {
@@ -54,7 +57,7 @@ func init() {
flags := lsCmd.Flags()
formatFlagName := "format"
- flags.StringVar(&listFlag.format, formatFlagName, "{{.Name}}\t{{.VMType}}\t{{.Created}}\t{{.LastUp}}\n", "Format volume output using Go template")
+ flags.StringVar(&listFlag.format, formatFlagName, "{{.Name}}\t{{.VMType}}\t{{.Created}}\t{{.LastUp}}\t{{.CPUs}}\t{{.Memory}}\t{{.DiskSize}}\n", "Format volume output using Go template")
_ = lsCmd.RegisterFlagCompletionFunc(formatFlagName, completion.AutocompleteNone)
flags.BoolVar(&listFlag.noHeading, "noheading", false, "Do not print headers")
}
@@ -85,8 +88,11 @@ func list(cmd *cobra.Command, args []string) error {
func outputTemplate(cmd *cobra.Command, responses []*machineReporter) error {
headers := report.Headers(machineReporter{}, map[string]string{
- "LastUp": "LAST UP",
- "VmType": "VM TYPE",
+ "LastUp": "LAST UP",
+ "VmType": "VM TYPE",
+ "CPUs": "CPUS",
+ "Memory": "MEMORY",
+ "DiskSize": "DISK SIZE",
})
row := report.NormalizeFormat(listFlag.format)
@@ -136,6 +142,9 @@ func toHumanFormat(vms []*machine.ListResponse) ([]*machineReporter, error) {
}
response.Created = units.HumanDuration(time.Since(vm.CreatedAt)) + " ago"
response.VMType = vm.VMType
+ response.CPUs = vm.CPUs
+ response.Memory = units.HumanSize(float64(vm.Memory) * units.MiB)
+ response.DiskSize = units.HumanSize(float64(vm.DiskSize) * units.GiB)
humanResponses = append(humanResponses, response)
}
diff --git a/cmd/podman/play/play.go b/cmd/podman/play/play.go
index f121d6a2d..d676bd701 100644
--- a/cmd/podman/play/play.go
+++ b/cmd/podman/play/play.go
@@ -10,7 +10,7 @@ var (
// Command: podman _play_
playCmd = &cobra.Command{
Use: "play",
- Short: "Play containers, pods or volumes from a structured file.",
+ Short: "Play containers, pods or volumes from a structured file",
Long: "Play structured data (e.g., Kubernetes YAML) based on containers, pods or volumes.",
RunE: validate.SubCommandExists,
}
diff --git a/cmd/podman/registry/config.go b/cmd/podman/registry/config.go
index 50e488b02..b512ba341 100644
--- a/cmd/podman/registry/config.go
+++ b/cmd/podman/registry/config.go
@@ -89,12 +89,7 @@ func newPodmanConfig() {
// use for the containers.conf configuration file.
func setXdgDirs() error {
if !rootless.IsRootless() {
- // unset XDG_RUNTIME_DIR for root
- // Sometimes XDG_RUNTIME_DIR is set to /run/user/0 sometimes it is unset,
- // the inconsistency is causing issues for the dnsname plugin.
- // It is already set to an empty string for conmon so lets do the same
- // for podman. see #10806 and #10745
- return os.Unsetenv("XDG_RUNTIME_DIR")
+ return nil
}
// Setup XDG_RUNTIME_DIR
diff --git a/cmd/podman/root.go b/cmd/podman/root.go
index c798e6634..2ab011631 100644
--- a/cmd/podman/root.go
+++ b/cmd/podman/root.go
@@ -92,6 +92,11 @@ func Execute() {
if registry.GetExitCode() == 0 {
registry.SetExitCode(define.ExecErrorCodeGeneric)
}
+ if registry.IsRemote() {
+ if strings.Contains(err.Error(), "unable to connect to Podman") {
+ fmt.Fprintln(os.Stderr, "Cannot connect to Podman. Please verify your connection to the Linux system using `podman system connection list`, or try `podman machine init` and `podman machine start` to manage a new Linux VM")
+ }
+ }
fmt.Fprintln(os.Stderr, formatError(err))
}
os.Exit(registry.GetExitCode())
diff --git a/cmd/podman/system/prune.go b/cmd/podman/system/prune.go
index e09e2d5e5..5565ea2f9 100644
--- a/cmd/podman/system/prune.go
+++ b/cmd/podman/system/prune.go
@@ -113,15 +113,15 @@ func prune(cmd *cobra.Command, args []string) error {
func createPruneWarningMessage(pruneOpts entities.SystemPruneOptions) string {
if pruneOpts.All {
- return `WARNING! This will remove:
+ return `WARNING! This command removes:
- all stopped containers
- all networks not used by at least one container%s
- - all images without at least one container associated to them
+ - all images without at least one container associated with them
- all build cache
%s`
}
- return `WARNING! This will remove:
+ return `WARNING! This command removes:
- all stopped containers
- all networks not used by at least one container%s
- all dangling images