diff --git a/vendor.conf b/vendor.conf index 5f9695f4..a7f38d7d 100644 --- a/vendor.conf +++ b/vendor.conf @@ -11,7 +11,7 @@ github.com/containernetworking/cni v0.4.0 google.golang.org/grpc v1.0.1-GA https://github.com/grpc/grpc-go github.com/opencontainers/selinux v1.0.0-rc1 github.com/opencontainers/go-digest v1.0.0-rc0 -github.com/opencontainers/runtime-tools f5c82b3918bdfc3ed4b594dcfab4d1554beaf992 +github.com/opencontainers/runtime-tools 96cb7c28a32209a530b94bceb491e0137d1f5849 github.com/opencontainers/runc b263a43430ac6996a4302b891688544225197294 github.com/opencontainers/image-spec v1.0.0-rc6 github.com/opencontainers/runtime-spec v1.0.0-rc5 diff --git a/vendor/github.com/opencontainers/runtime-tools/generate/generate.go b/vendor/github.com/opencontainers/runtime-tools/generate/generate.go index 5ca0e315..42b68231 100644 --- a/vendor/github.com/opencontainers/runtime-tools/generate/generate.go +++ b/vendor/github.com/opencontainers/runtime-tools/generate/generate.go @@ -714,12 +714,15 @@ func (g *Generator) ClearPreStartHooks() { if g.spec == nil { return } + if g.spec.Hooks == nil { + return + } g.spec.Hooks.Prestart = []rspec.Hook{} } // AddPreStartHook add a prestart hook into g.spec.Hooks.Prestart. func (g *Generator) AddPreStartHook(path string, args []string) { - g.initSpec() + g.initSpecHooks() hook := rspec.Hook{Path: path, Args: args} g.spec.Hooks.Prestart = append(g.spec.Hooks.Prestart, hook) } @@ -729,12 +732,15 @@ func (g *Generator) ClearPostStopHooks() { if g.spec == nil { return } + if g.spec.Hooks == nil { + return + } g.spec.Hooks.Poststop = []rspec.Hook{} } // AddPostStopHook adds a poststop hook into g.spec.Hooks.Poststop. func (g *Generator) AddPostStopHook(path string, args []string) { - g.initSpec() + g.initSpecHooks() hook := rspec.Hook{Path: path, Args: args} g.spec.Hooks.Poststop = append(g.spec.Hooks.Poststop, hook) } @@ -744,12 +750,15 @@ func (g *Generator) ClearPostStartHooks() { if g.spec == nil { return } + if g.spec.Hooks == nil { + return + } g.spec.Hooks.Poststart = []rspec.Hook{} } // AddPostStartHook adds a poststart hook into g.spec.Hooks.Poststart. func (g *Generator) AddPostStartHook(path string, args []string) { - g.initSpec() + g.initSpecHooks() hook := rspec.Hook{Path: path, Args: args} g.spec.Hooks.Poststart = append(g.spec.Hooks.Poststart, hook) } diff --git a/vendor/github.com/opencontainers/runtime-tools/generate/spec.go b/vendor/github.com/opencontainers/runtime-tools/generate/spec.go index 4498aa14..463be3f4 100644 --- a/vendor/github.com/opencontainers/runtime-tools/generate/spec.go +++ b/vendor/github.com/opencontainers/runtime-tools/generate/spec.go @@ -17,6 +17,13 @@ func (g *Generator) initSpecAnnotations() { } } +func (g *Generator) initSpecHooks() { + g.initSpec() + if g.spec.Hooks == nil { + g.spec.Hooks = &rspec.Hooks{} + } +} + func (g *Generator) initSpecLinux() { g.initSpec() if g.spec.Linux == nil { diff --git a/vendor/github.com/opencontainers/runtime-tools/validate/validate.go b/vendor/github.com/opencontainers/runtime-tools/validate/validate.go index 73aea024..b3b1bbff 100644 --- a/vendor/github.com/opencontainers/runtime-tools/validate/validate.go +++ b/vendor/github.com/opencontainers/runtime-tools/validate/validate.go @@ -131,8 +131,13 @@ func (v *Validator) CheckRootfsPath() (msgs []string) { msgs = append(msgs, fmt.Sprintf("root.path is %q, but it MUST be a child of %q", v.spec.Root.Path, absBundlePath)) } - return + if v.spec.Platform.OS == "windows" { + if v.spec.Root.Readonly { + msgs = append(msgs, "root.readonly field MUST be omitted or false when platform.os is windows") + } + } + return } // CheckSemVer checks v.spec.Version