summaryrefslogtreecommitdiff
path: root/pkg/hooks/0.1.0/hook.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2020-06-16 16:21:43 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2020-06-17 05:39:57 -0400
commita36bc1526652341126a180a304d99777378375ff (patch)
treeb259937f964aaa063389cba6d595f7a907b881e5 /pkg/hooks/0.1.0/hook.go
parent4fb0f56063de13af53128be9da81027d988516be (diff)
downloadpodman-a36bc1526652341126a180a304d99777378375ff.tar.gz
podman-a36bc1526652341126a180a304d99777378375ff.tar.bz2
podman-a36bc1526652341126a180a304d99777378375ff.zip
Fix handling of old oci hooks
Podman is blowing up with oci-umount hook, because it was never rewritten to support the v1.0.0 value. This PR adds support for the older version and cleans up the hook handling. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/hooks/0.1.0/hook.go')
-rw-r--r--pkg/hooks/0.1.0/hook.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/pkg/hooks/0.1.0/hook.go b/pkg/hooks/0.1.0/hook.go
index 88a387647..185cc90d1 100644
--- a/pkg/hooks/0.1.0/hook.go
+++ b/pkg/hooks/0.1.0/hook.go
@@ -6,7 +6,6 @@ import (
"errors"
"strings"
- "github.com/containers/libpod/pkg/hooks"
current "github.com/containers/libpod/pkg/hooks/1.0.0"
rspec "github.com/opencontainers/runtime-spec/specs-go"
)
@@ -32,8 +31,9 @@ type Hook struct {
HasBindMounts *bool `json:"hasbindmounts,omitempty"`
}
-func read(content []byte) (hook *current.Hook, err error) {
+func Read(content []byte) (hook *current.Hook, err error) {
var raw Hook
+
if err = json.Unmarshal(content, &raw); err != nil {
return nil, err
}
@@ -86,8 +86,3 @@ func read(content []byte) (hook *current.Hook, err error) {
return hook, nil
}
-
-func init() {
- hooks.Readers[""] = read
- hooks.Readers[Version] = read
-}