diff options
| author | Bruce Ashfield <bruce.ashfield@windriver.com> | 2017-09-20 23:56:25 -0400 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2017-09-20 23:56:25 -0400 |
| commit | 6c3a6c31cc477dae7524f21b147783c0bd1c0a93 (patch) | |
| tree | fe6a7412156cf5420fc8df96e2f56574b9a5d35e /recipes-containers/oci-runtime-tools/files/0001-Revert-implement-add-set-function-for-hooks-items.patch | |
| parent | 4557a1b2866ad157de650896323b084475d35ea4 (diff) | |
| download | meta-virtualization-6c3a6c31cc477dae7524f21b147783c0bd1c0a93.tar.gz | |
oci-runtime-tools: fix multi hook specification
The following commit:
commit df3a46feb971386f922c7c2c2822b88301f87cb0
Author: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
Date: Tue Aug 1 17:39:39 2017 +0800
implement add/set function for hooks items
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
Breaks the ability to specify multiple hooks with the same path
(i.e. a shell script that does different things based on arguments).
The author's intent with the change is unclear, so rather than fix
it, we revert it for now.
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'recipes-containers/oci-runtime-tools/files/0001-Revert-implement-add-set-function-for-hooks-items.patch')
| -rw-r--r-- | recipes-containers/oci-runtime-tools/files/0001-Revert-implement-add-set-function-for-hooks-items.patch | 202 |
1 files changed, 202 insertions, 0 deletions
diff --git a/recipes-containers/oci-runtime-tools/files/0001-Revert-implement-add-set-function-for-hooks-items.patch b/recipes-containers/oci-runtime-tools/files/0001-Revert-implement-add-set-function-for-hooks-items.patch new file mode 100644 index 00000000..99a9310b --- /dev/null +++ b/recipes-containers/oci-runtime-tools/files/0001-Revert-implement-add-set-function-for-hooks-items.patch | |||
| @@ -0,0 +1,202 @@ | |||
| 1 | From 2911eaabab92ec2cdea2b173c3429db4a52bee2f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Bruce Ashfield <bruce.ashfield@windriver.com> | ||
| 3 | Date: Wed, 20 Sep 2017 23:28:52 -0400 | ||
| 4 | Subject: [PATCH] Revert "implement add/set function for hooks items" | ||
| 5 | |||
| 6 | This reverts commit df3a46feb971386f922c7c2c2822b88301f87cb0. | ||
| 7 | --- | ||
| 8 | cmd/oci-runtime-tool/generate.go | 12 ++++++------ | ||
| 9 | generate/generate.go | 42 ++++++---------------------------------- | ||
| 10 | 2 files changed, 12 insertions(+), 42 deletions(-) | ||
| 11 | |||
| 12 | diff --git a/src/import/cmd/oci-runtime-tool/generate.go b/src/import/cmd/oci-runtime-tool/generate.go | ||
| 13 | index ed11fe8f3729..7121ce5fe07e 100644 | ||
| 14 | --- a/src/import/cmd/oci-runtime-tool/generate.go | ||
| 15 | +++ b/src/import/cmd/oci-runtime-tool/generate.go | ||
| 16 | @@ -354,7 +354,7 @@ func setupSpec(g *generate.Generator, context *cli.Context) error { | ||
| 17 | for _, postStartEnv := range postStartEnvs { | ||
| 18 | path, env, err := parseHookEnv(postStartEnv) | ||
| 19 | if err != nil { | ||
| 20 | - return err | ||
| 21 | + return nil | ||
| 22 | } | ||
| 23 | g.AddPostStartHookEnv(path, env) | ||
| 24 | } | ||
| 25 | @@ -387,7 +387,7 @@ func setupSpec(g *generate.Generator, context *cli.Context) error { | ||
| 26 | for _, postStopEnv := range postStopEnvs { | ||
| 27 | path, env, err := parseHookEnv(postStopEnv) | ||
| 28 | if err != nil { | ||
| 29 | - return err | ||
| 30 | + return nil | ||
| 31 | } | ||
| 32 | g.AddPostStopHookEnv(path, env) | ||
| 33 | } | ||
| 34 | @@ -398,7 +398,7 @@ func setupSpec(g *generate.Generator, context *cli.Context) error { | ||
| 35 | for _, postStopTimeout := range postStopTimeouts { | ||
| 36 | path, timeout, err := parseHookTimeout(postStopTimeout) | ||
| 37 | if err != nil { | ||
| 38 | - return err | ||
| 39 | + return nil | ||
| 40 | } | ||
| 41 | g.AddPostStopHookTimeout(path, timeout) | ||
| 42 | } | ||
| 43 | @@ -409,7 +409,7 @@ func setupSpec(g *generate.Generator, context *cli.Context) error { | ||
| 44 | for _, hook := range preStartHooks { | ||
| 45 | path, args, err := parseHook(hook) | ||
| 46 | if err != nil { | ||
| 47 | - return err | ||
| 48 | + return nil | ||
| 49 | } | ||
| 50 | g.AddPreStartHook(path, args) | ||
| 51 | } | ||
| 52 | @@ -420,7 +420,7 @@ func setupSpec(g *generate.Generator, context *cli.Context) error { | ||
| 53 | for _, preStartEnv := range preStartEnvs { | ||
| 54 | path, env, err := parseHookEnv(preStartEnv) | ||
| 55 | if err != nil { | ||
| 56 | - return err | ||
| 57 | + return nil | ||
| 58 | } | ||
| 59 | g.AddPreStartHookEnv(path, env) | ||
| 60 | } | ||
| 61 | @@ -431,7 +431,7 @@ func setupSpec(g *generate.Generator, context *cli.Context) error { | ||
| 62 | for _, preStartTimeout := range preStartTimeouts { | ||
| 63 | path, timeout, err := parseHookTimeout(preStartTimeout) | ||
| 64 | if err != nil { | ||
| 65 | - return err | ||
| 66 | + return nil | ||
| 67 | } | ||
| 68 | g.AddPreStartHookTimeout(path, timeout) | ||
| 69 | } | ||
| 70 | diff --git a/src/import/generate/generate.go b/src/import/generate/generate.go | ||
| 71 | index 84762c3cbd05..ef5d2cc95b3c 100644 | ||
| 72 | --- a/src/import/generate/generate.go | ||
| 73 | +++ b/src/import/generate/generate.go | ||
| 74 | @@ -744,39 +744,29 @@ func (g *Generator) ClearPreStartHooks() { | ||
| 75 | func (g *Generator) AddPreStartHook(path string, args []string) { | ||
| 76 | g.initSpecHooks() | ||
| 77 | hook := rspec.Hook{Path: path, Args: args} | ||
| 78 | - for i, hook := range g.spec.Hooks.Prestart { | ||
| 79 | - if hook.Path == path { | ||
| 80 | - g.spec.Hooks.Prestart[i] = hook | ||
| 81 | - return | ||
| 82 | - } | ||
| 83 | - } | ||
| 84 | g.spec.Hooks.Prestart = append(g.spec.Hooks.Prestart, hook) | ||
| 85 | } | ||
| 86 | |||
| 87 | // AddPreStartHookEnv adds envs of a prestart hook into g.spec.Hooks.Prestart. | ||
| 88 | func (g *Generator) AddPreStartHookEnv(path string, envs []string) { | ||
| 89 | - g.initSpecHooks() | ||
| 90 | + g.initSpec() | ||
| 91 | for i, hook := range g.spec.Hooks.Prestart { | ||
| 92 | if hook.Path == path { | ||
| 93 | g.spec.Hooks.Prestart[i].Env = envs | ||
| 94 | return | ||
| 95 | } | ||
| 96 | } | ||
| 97 | - hook := rspec.Hook{Path: path, Env: envs} | ||
| 98 | - g.spec.Hooks.Prestart = append(g.spec.Hooks.Prestart, hook) | ||
| 99 | } | ||
| 100 | |||
| 101 | // AddPreStartHookTimeout adds timeout of a prestart hook into g.spec.Hooks.Prestart. | ||
| 102 | func (g *Generator) AddPreStartHookTimeout(path string, timeout int) { | ||
| 103 | - g.initSpecHooks() | ||
| 104 | + g.initSpec() | ||
| 105 | for i, hook := range g.spec.Hooks.Prestart { | ||
| 106 | if hook.Path == path { | ||
| 107 | g.spec.Hooks.Prestart[i].Timeout = &timeout | ||
| 108 | return | ||
| 109 | } | ||
| 110 | } | ||
| 111 | - hook := rspec.Hook{Path: path, Timeout: &timeout} | ||
| 112 | - g.spec.Hooks.Prestart = append(g.spec.Hooks.Prestart, hook) | ||
| 113 | } | ||
| 114 | |||
| 115 | // ClearPostStopHooks clear g.spec.Hooks.Poststop. | ||
| 116 | @@ -794,39 +784,29 @@ func (g *Generator) ClearPostStopHooks() { | ||
| 117 | func (g *Generator) AddPostStopHook(path string, args []string) { | ||
| 118 | g.initSpecHooks() | ||
| 119 | hook := rspec.Hook{Path: path, Args: args} | ||
| 120 | - for i, hook := range g.spec.Hooks.Poststop { | ||
| 121 | - if hook.Path == path { | ||
| 122 | - g.spec.Hooks.Poststop[i] = hook | ||
| 123 | - return | ||
| 124 | - } | ||
| 125 | - } | ||
| 126 | g.spec.Hooks.Poststop = append(g.spec.Hooks.Poststop, hook) | ||
| 127 | } | ||
| 128 | |||
| 129 | // AddPostStopHookEnv adds envs of a poststop hook into g.spec.Hooks.Poststop. | ||
| 130 | func (g *Generator) AddPostStopHookEnv(path string, envs []string) { | ||
| 131 | - g.initSpecHooks() | ||
| 132 | + g.initSpec() | ||
| 133 | for i, hook := range g.spec.Hooks.Poststop { | ||
| 134 | if hook.Path == path { | ||
| 135 | g.spec.Hooks.Poststop[i].Env = envs | ||
| 136 | return | ||
| 137 | } | ||
| 138 | } | ||
| 139 | - hook := rspec.Hook{Path: path, Env: envs} | ||
| 140 | - g.spec.Hooks.Poststop = append(g.spec.Hooks.Poststop, hook) | ||
| 141 | } | ||
| 142 | |||
| 143 | // AddPostStopHookTimeout adds timeout of a poststop hook into g.spec.Hooks.Poststop. | ||
| 144 | func (g *Generator) AddPostStopHookTimeout(path string, timeout int) { | ||
| 145 | - g.initSpecHooks() | ||
| 146 | + g.initSpec() | ||
| 147 | for i, hook := range g.spec.Hooks.Poststop { | ||
| 148 | if hook.Path == path { | ||
| 149 | g.spec.Hooks.Poststop[i].Timeout = &timeout | ||
| 150 | return | ||
| 151 | } | ||
| 152 | } | ||
| 153 | - hook := rspec.Hook{Path: path, Timeout: &timeout} | ||
| 154 | - g.spec.Hooks.Poststop = append(g.spec.Hooks.Poststop, hook) | ||
| 155 | } | ||
| 156 | |||
| 157 | // ClearPostStartHooks clear g.spec.Hooks.Poststart. | ||
| 158 | @@ -844,39 +824,29 @@ func (g *Generator) ClearPostStartHooks() { | ||
| 159 | func (g *Generator) AddPostStartHook(path string, args []string) { | ||
| 160 | g.initSpecHooks() | ||
| 161 | hook := rspec.Hook{Path: path, Args: args} | ||
| 162 | - for i, hook := range g.spec.Hooks.Poststart { | ||
| 163 | - if hook.Path == path { | ||
| 164 | - g.spec.Hooks.Poststart[i] = hook | ||
| 165 | - return | ||
| 166 | - } | ||
| 167 | - } | ||
| 168 | g.spec.Hooks.Poststart = append(g.spec.Hooks.Poststart, hook) | ||
| 169 | } | ||
| 170 | |||
| 171 | // AddPostStartHookEnv adds envs of a poststart hook into g.spec.Hooks.Poststart. | ||
| 172 | func (g *Generator) AddPostStartHookEnv(path string, envs []string) { | ||
| 173 | - g.initSpecHooks() | ||
| 174 | + g.initSpec() | ||
| 175 | for i, hook := range g.spec.Hooks.Poststart { | ||
| 176 | if hook.Path == path { | ||
| 177 | g.spec.Hooks.Poststart[i].Env = envs | ||
| 178 | return | ||
| 179 | } | ||
| 180 | } | ||
| 181 | - hook := rspec.Hook{Path: path, Env: envs} | ||
| 182 | - g.spec.Hooks.Poststart = append(g.spec.Hooks.Poststart, hook) | ||
| 183 | } | ||
| 184 | |||
| 185 | // AddPostStartHookTimeout adds timeout of a poststart hook into g.spec.Hooks.Poststart. | ||
| 186 | func (g *Generator) AddPostStartHookTimeout(path string, timeout int) { | ||
| 187 | - g.initSpecHooks() | ||
| 188 | + g.initSpec() | ||
| 189 | for i, hook := range g.spec.Hooks.Poststart { | ||
| 190 | if hook.Path == path { | ||
| 191 | g.spec.Hooks.Poststart[i].Timeout = &timeout | ||
| 192 | return | ||
| 193 | } | ||
| 194 | } | ||
| 195 | - hook := rspec.Hook{Path: path, Timeout: &timeout} | ||
| 196 | - g.spec.Hooks.Poststart = append(g.spec.Hooks.Poststart, hook) | ||
| 197 | } | ||
| 198 | |||
| 199 | // AddTmpfsMount adds a tmpfs mount into g.spec.Mounts. | ||
| 200 | -- | ||
| 201 | 2.4.0.53.g8440f74 | ||
| 202 | |||
