summaryrefslogtreecommitdiff
path: root/pkg/hooks/read.go
diff options
context:
space:
mode:
authorW. Trevor King <wking@tremily.us>2018-05-11 13:03:28 -0700
committerAtomic Bot <atomic-devel@projectatomic.io>2018-05-14 21:36:48 +0000
commit45838b9561977f3e79cf2e61c7ed0dfd9badb303 (patch)
tree40dc9cd883b07f47b36589ff7b77c32c6304f669 /pkg/hooks/read.go
parent69a6cb255ca98bc7a9e6d47c7a0ccaacab895a25 (diff)
downloadpodman-45838b9561977f3e79cf2e61c7ed0dfd9badb303.tar.gz
podman-45838b9561977f3e79cf2e61c7ed0dfd9badb303.tar.bz2
podman-45838b9561977f3e79cf2e61c7ed0dfd9badb303.zip
hooks: Add package support for extension stages
We aren't consuming this yet, but these pkg/hooks changes lay the groundwork for future libpod changes to support post-exit hooks [1,2]. [1]: https://github.com/projectatomic/libpod/issues/730 [2]: https://github.com/opencontainers/runc/issues/1797 Signed-off-by: W. Trevor King <wking@tremily.us> Closes: #758 Approved by: rhatdan
Diffstat (limited to 'pkg/hooks/read.go')
-rw-r--r--pkg/hooks/read.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/hooks/read.go b/pkg/hooks/read.go
index 29953ac5d..ae34913b6 100644
--- a/pkg/hooks/read.go
+++ b/pkg/hooks/read.go
@@ -25,7 +25,7 @@ var (
)
// Read reads a hook JSON file, verifies it, and returns the hook configuration.
-func Read(path string) (*current.Hook, error) {
+func Read(path string, extensionStages []string) (*current.Hook, error) {
if !strings.HasSuffix(path, ".json") {
return nil, ErrNoJSONSuffix
}
@@ -37,7 +37,7 @@ func Read(path string) (*current.Hook, error) {
if err != nil {
return nil, errors.Wrapf(err, "parsing hook %q", path)
}
- err = hook.Validate()
+ err = hook.Validate(extensionStages)
return hook, err
}
@@ -60,14 +60,14 @@ func read(content []byte) (hook *current.Hook, err error) {
// ReadDir reads hook JSON files from a directory into the given map,
// clobbering any previous entries with the same filenames.
-func ReadDir(path string, hooks map[string]*current.Hook) error {
+func ReadDir(path string, extensionStages []string, hooks map[string]*current.Hook) error {
files, err := ioutil.ReadDir(path)
if err != nil {
return err
}
for _, file := range files {
- hook, err := Read(filepath.Join(path, file.Name()))
+ hook, err := Read(filepath.Join(path, file.Name()), extensionStages)
if err != nil {
if err == ErrNoJSONSuffix {
continue