diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2020-11-06 09:55:40 -0500 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2020-11-20 13:55:19 -0500 |
commit | dc8996ec84ffd6f272361edbf7c19e91c52519d9 (patch) | |
tree | 77365b93b7f2652ff2a6314a1edc98c5f3f8913d /pkg/bindings | |
parent | 864fe21ed02ca6faa72e6a94f06c9961167aca7d (diff) | |
download | podman-dc8996ec84ffd6f272361edbf7c19e91c52519d9.tar.gz podman-dc8996ec84ffd6f272361edbf7c19e91c52519d9.tar.bz2 podman-dc8996ec84ffd6f272361edbf7c19e91c52519d9.zip |
Allow containers to --restart on-failure with --rm
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/bindings')
-rw-r--r-- | pkg/bindings/containers/containers.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/pkg/bindings/containers/containers.go b/pkg/bindings/containers/containers.go index b5cd2128b..4331ae6c2 100644 --- a/pkg/bindings/containers/containers.go +++ b/pkg/bindings/containers/containers.go @@ -390,3 +390,15 @@ func ContainerInit(ctx context.Context, nameOrID string) error { } return response.Process(nil) } + +func ShouldRestart(ctx context.Context, nameOrID string) (bool, error) { + conn, err := bindings.GetClient(ctx) + if err != nil { + return false, err + } + response, err := conn.DoRequest(nil, http.MethodPost, "/containers/%s/shouldrestart", nil, nil, nameOrID) + if err != nil { + return false, err + } + return response.IsSuccess(), nil +} |