summaryrefslogtreecommitdiff
path: root/libpod/container_internal.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-09-17 09:33:11 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-09-17 16:28:28 +0000
commit800eb8633850ddbcd01aa827fe4e505e6075e253 (patch)
tree92502a354452da67983a4114f31fc60acf8e965b /libpod/container_internal.go
parent8b66eae7d8dcb298d05bfb0234104bfda6be3929 (diff)
downloadpodman-800eb8633850ddbcd01aa827fe4e505e6075e253.tar.gz
podman-800eb8633850ddbcd01aa827fe4e505e6075e253.tar.bz2
podman-800eb8633850ddbcd01aa827fe4e505e6075e253.zip
Hooks supports two directories, process default and override
ALso cleanup files section or podman man page Add description of policy.json Sort alphabetically. Add more info on oci hooks Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #1487 Approved by: umohnani8
Diffstat (limited to 'libpod/container_internal.go')
-rw-r--r--libpod/container_internal.go25
1 files changed, 17 insertions, 8 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 79bc49c37..e5e871d6f 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -1246,7 +1246,7 @@ func (c *Container) saveSpec(spec *spec.Spec) error {
}
func (c *Container) setupOCIHooks(ctx context.Context, config *spec.Spec) (extensionStageHooks map[string][]spec.Hook, err error) {
- if c.runtime.config.HooksDir == "" {
+ if len(c.runtime.config.HooksDir) == 0 {
return nil, nil
}
@@ -1277,16 +1277,25 @@ func (c *Container) setupOCIHooks(ctx context.Context, config *spec.Spec) (exten
}
}
- manager, err := hooks.New(ctx, []string{c.runtime.config.HooksDir}, []string{"poststop"}, lang)
- if err != nil {
- if c.runtime.config.HooksDirNotExistFatal || !os.IsNotExist(err) {
+ var allHooks map[string][]spec.Hook
+ for _, hDir := range c.runtime.config.HooksDir {
+ manager, err := hooks.New(ctx, []string{hDir}, []string{"poststop"}, lang)
+ if err != nil {
+ if c.runtime.config.HooksDirNotExistFatal || !os.IsNotExist(err) {
+ return nil, err
+ }
+ logrus.Warnf("failed to load hooks: {}", err)
+ return nil, nil
+ }
+ hooks, err := manager.Hooks(config, c.Spec().Annotations, len(c.config.UserVolumes) > 0)
+ if err != nil {
return nil, err
}
- logrus.Warnf("failed to load hooks: {}", err)
- return nil, nil
+ for i, hook := range hooks {
+ allHooks[i] = hook
+ }
}
-
- return manager.Hooks(config, c.Spec().Annotations, len(c.config.UserVolumes) > 0)
+ return allHooks, nil
}
// mount mounts the container's root filesystem