summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authoropenshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com>2022-07-05 17:33:19 +0000
committerGitHub <noreply@github.com>2022-07-05 17:33:19 +0000
commitcf747399b13432d000cfd9556a248681363dda2d (patch)
tree14ef73da2b1eb43ed41a1a89bd5582444938a16a /cmd/podman
parent39fc5d1f4f26f82ed1ca23d97f43924335c4c529 (diff)
parent65d511c6d859f250b6e45107315436e73f125c3a (diff)
downloadpodman-cf747399b13432d000cfd9556a248681363dda2d.tar.gz
podman-cf747399b13432d000cfd9556a248681363dda2d.tar.bz2
podman-cf747399b13432d000cfd9556a248681363dda2d.zip
Merge pull request #14370 from umohnani8/todo
Fix podman pod unpause TODO
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/common/completion.go10
-rw-r--r--cmd/podman/pods/unpause.go6
2 files changed, 12 insertions, 4 deletions
diff --git a/cmd/podman/common/completion.go b/cmd/podman/common/completion.go
index 89e53c180..ae30f2875 100644
--- a/cmd/podman/common/completion.go
+++ b/cmd/podman/common/completion.go
@@ -520,6 +520,16 @@ func AutocompletePodsRunning(cmd *cobra.Command, args []string, toComplete strin
return getPods(cmd, toComplete, completeDefault, "running", "degraded")
}
+// AutoCompletePodsPause - Autocomplete only paused pod names
+// When a pod has a few containers paused, that ends up in degraded state
+// So autocomplete degraded pod names as well
+func AutoCompletePodsPause(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
+ if !validCurrentCmdLine(cmd, args, toComplete) {
+ return nil, cobra.ShellCompDirectiveNoFileComp
+ }
+ return getPods(cmd, toComplete, completeDefault, "paused", "degraded")
+}
+
// AutocompleteForKube - Autocomplete all Podman objects supported by kube generate.
func AutocompleteForKube(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
if !validCurrentCmdLine(cmd, args, toComplete) {
diff --git a/cmd/podman/pods/unpause.go b/cmd/podman/pods/unpause.go
index 8a0a24e98..47b29458b 100644
--- a/cmd/podman/pods/unpause.go
+++ b/cmd/podman/pods/unpause.go
@@ -24,9 +24,7 @@ var (
Args: func(cmd *cobra.Command, args []string) error {
return validate.CheckAllLatestAndIDFile(cmd, args, false, "")
},
- // TODO have a function which shows only pods which could be unpaused
- // for now show all
- ValidArgsFunction: common.AutocompletePods,
+ ValidArgsFunction: common.AutoCompletePodsPause,
Example: `podman pod unpause podID1 podID2
podman pod unpause --all
podman pod unpause --latest`,
@@ -43,7 +41,7 @@ func init() {
Parent: podCmd,
})
flags := unpauseCommand.Flags()
- flags.BoolVarP(&unpauseOptions.All, "all", "a", false, "Pause all running pods")
+ flags.BoolVarP(&unpauseOptions.All, "all", "a", false, "Unpause all running pods")
validate.AddLatestFlag(unpauseCommand, &unpauseOptions.Latest)
}