diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2020-06-16 16:21:43 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2020-06-17 05:39:57 -0400 |
commit | a36bc1526652341126a180a304d99777378375ff (patch) | |
tree | b259937f964aaa063389cba6d595f7a907b881e5 /pkg/hooks/read.go | |
parent | 4fb0f56063de13af53128be9da81027d988516be (diff) | |
download | podman-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/read.go')
-rw-r--r-- | pkg/hooks/read.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pkg/hooks/read.go b/pkg/hooks/read.go index 560ff1899..e20ae9bee 100644 --- a/pkg/hooks/read.go +++ b/pkg/hooks/read.go @@ -3,12 +3,12 @@ package hooks import ( "encoding/json" - "fmt" "io/ioutil" "os" "path/filepath" "strings" + old "github.com/containers/libpod/pkg/hooks/0.1.0" current "github.com/containers/libpod/pkg/hooks/1.0.0" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -49,7 +49,7 @@ func read(content []byte) (hook *current.Hook, err error) { } reader, ok := Readers[ver.Version] if !ok { - return nil, fmt.Errorf("unrecognized hook version: %q", ver.Version) + return nil, errors.Errorf("unrecognized hook version: %q", ver.Version) } hook, err = reader(content) @@ -95,4 +95,6 @@ func ReadDir(path string, extensionStages []string, hooks map[string]*current.Ho func init() { Readers[current.Version] = current.Read + Readers[old.Version] = old.Read + Readers[""] = old.Read } |