Add --replace flag to podman secret create

Users may want to replace the secret used within containers, without
destroying the secret and recreating it.

Partial fix for https://github.com/containers/podman/issues/18667

Make sure podman --remote secret inspect and podman secret inspect
return the same error message.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2023-07-09 07:26:09 -04:00
parent 5d706eb027
commit efefd8cf5b
9 changed files with 55 additions and 3 deletions

View File

@@ -24,6 +24,7 @@ func CreateSecret(w http.ResponseWriter, r *http.Request) {
Driver string `schema:"driver"`
DriverOpts map[string]string `schema:"driveropts"`
Labels map[string]string `schema:"labels"`
Replace bool `schema:"replace"`
}{
// override any golang type defaults
}
@@ -36,6 +37,7 @@ func CreateSecret(w http.ResponseWriter, r *http.Request) {
opts.Driver = query.Driver
opts.DriverOpts = query.DriverOpts
opts.Labels = query.Labels
opts.Replace = query.Replace
ic := abi.ContainerEngine{Libpod: runtime}
report, err := ic.SecretCreate(r.Context(), query.Name, r.Body, opts)