summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/containers/rm.go7
-rw-r--r--cmd/podman/inspect/inspect.go17
-rw-r--r--cmd/podman/kube/down.go3
-rw-r--r--cmd/podman/kube/play.go26
4 files changed, 45 insertions, 8 deletions
diff --git a/cmd/podman/containers/rm.go b/cmd/podman/containers/rm.go
index 1e3976389..9c760e752 100644
--- a/cmd/podman/containers/rm.go
+++ b/cmd/podman/containers/rm.go
@@ -149,7 +149,8 @@ func removeContainers(namesOrIDs []string, rmOptions entities.RmOptions, setExit
return err
}
for _, r := range responses {
- if r.Err != nil {
+ switch {
+ case r.Err != nil:
if errors.Is(r.Err, define.ErrWillDeadlock) {
logrus.Errorf("Potential deadlock detected - please run 'podman system renumber' to resolve")
}
@@ -160,8 +161,10 @@ func removeContainers(namesOrIDs []string, rmOptions entities.RmOptions, setExit
setExitCode(r.Err)
}
errs = append(errs, r.Err)
- } else {
+ case r.RawInput != "":
fmt.Println(r.RawInput)
+ default:
+ fmt.Println(r.Id)
}
}
return errs.PrintErrors()
diff --git a/cmd/podman/inspect/inspect.go b/cmd/podman/inspect/inspect.go
index edddf026e..d519bc7d9 100644
--- a/cmd/podman/inspect/inspect.go
+++ b/cmd/podman/inspect/inspect.go
@@ -201,7 +201,7 @@ func (i *inspector) inspect(namesOrIDs []string) error {
err = printJSON(data)
default:
// Landing here implies user has given a custom --format
- row := inspectNormalize(i.options.Format)
+ row := inspectNormalize(i.options.Format, tmpType)
row = report.NormalizeFormat(row)
row = report.EnforceRange(row)
err = printTmpl(tmpType, row, data)
@@ -300,7 +300,7 @@ func (i *inspector) inspectAll(ctx context.Context, namesOrIDs []string) ([]inte
return data, allErrs, nil
}
-func inspectNormalize(row string) string {
+func inspectNormalize(row string, inspectType string) string {
m := regexp.MustCompile(`{{\s*\.Id\s*}}`)
row = m.ReplaceAllString(row, "{{.ID}}")
@@ -309,5 +309,18 @@ func inspectNormalize(row string) string {
".Dst", ".Destination",
".ImageID", ".Image",
)
+
+ // If inspect type is `image` we need to replace
+ // certain additional fields like `.Config.HealthCheck`
+ // but don't want to replace them for other inspect types.
+ if inspectType == common.ImageType {
+ r = strings.NewReplacer(
+ ".Src", ".Source",
+ ".Dst", ".Destination",
+ ".ImageID", ".Image",
+ ".Config.Healthcheck", ".HealthCheck",
+ )
+ }
+
return r.Replace(row)
}
diff --git a/cmd/podman/kube/down.go b/cmd/podman/kube/down.go
index a670d911c..792c80499 100644
--- a/cmd/podman/kube/down.go
+++ b/cmd/podman/kube/down.go
@@ -19,7 +19,8 @@ var (
Args: cobra.ExactArgs(1),
ValidArgsFunction: common.AutocompleteDefaultOneArg,
Example: `podman kube down nginx.yml
- cat nginx.yml | podman kube down -`,
+ cat nginx.yml | podman kube down -
+ podman kube down https://example.com/nginx.yml`,
}
)
diff --git a/cmd/podman/kube/play.go b/cmd/podman/kube/play.go
index d7719e28e..c846ec32c 100644
--- a/cmd/podman/kube/play.go
+++ b/cmd/podman/kube/play.go
@@ -5,7 +5,9 @@ import (
"errors"
"fmt"
"io"
+ "io/ioutil"
"net"
+ "net/http"
"os"
"strings"
@@ -13,6 +15,7 @@ import (
"github.com/containers/common/pkg/completion"
"github.com/containers/image/v5/types"
"github.com/containers/podman/v4/cmd/podman/common"
+ "github.com/containers/podman/v4/cmd/podman/parse"
"github.com/containers/podman/v4/cmd/podman/registry"
"github.com/containers/podman/v4/cmd/podman/utils"
"github.com/containers/podman/v4/libpod/define"
@@ -52,7 +55,8 @@ var (
ValidArgsFunction: common.AutocompleteDefaultOneArg,
Example: `podman kube play nginx.yml
cat nginx.yml | podman kube play -
- podman kube play --creds user:password --seccomp-profile-root /custom/path apache.yml`,
+ podman kube play --creds user:password --seccomp-profile-root /custom/path apache.yml
+ podman kube play https://example.com/nginx.yml`,
}
)
@@ -67,7 +71,8 @@ var (
ValidArgsFunction: common.AutocompleteDefaultOneArg,
Example: `podman play kube nginx.yml
cat nginx.yml | podman play kube -
- podman play kube --creds user:password --seccomp-profile-root /custom/path apache.yml`,
+ podman play kube --creds user:password --seccomp-profile-root /custom/path apache.yml
+ podman play kube https://example.com/nginx.yml`,
}
)
@@ -167,7 +172,7 @@ func playFlags(cmd *cobra.Command) {
_ = cmd.RegisterFlagCompletionFunc(contextDirFlagName, completion.AutocompleteDefault)
// NOTE: The service-container flag is marked as hidden as it
- // is purely designed for running kube-play in systemd units.
+ // is purely designed for running kube-play or 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.
@@ -255,6 +260,7 @@ func play(cmd *cobra.Command, args []string) error {
return err
}
}
+
return kubeplay(reader)
}
@@ -263,6 +269,7 @@ func playKube(cmd *cobra.Command, args []string) error {
}
func readerFromArg(fileName string) (*bytes.Reader, error) {
+ errURL := parse.ValidURL(fileName)
if fileName == "-" { // Read from stdin
data, err := io.ReadAll(os.Stdin)
if err != nil {
@@ -270,6 +277,19 @@ func readerFromArg(fileName string) (*bytes.Reader, error) {
}
return bytes.NewReader(data), nil
}
+ if errURL == nil {
+ response, err := http.Get(fileName)
+ if err != nil {
+ return nil, err
+ }
+ defer response.Body.Close()
+
+ data, err := ioutil.ReadAll(response.Body)
+ if err != nil {
+ return nil, err
+ }
+ return bytes.NewReader(data), nil
+ }
f, err := os.Open(fileName)
if err != nil {
return nil, err