@@ -914,12 +914,6 @@ func (g *Generator) ClearPreStartHooks() {
914
914
// AddPreStartHook add a prestart hook into g.spec.Hooks.Prestart.
915
915
func (g * Generator ) AddPreStartHook (preStartHook rspec.Hook ) error {
916
916
g .initSpecHooks ()
917
- for i , hook := range g .spec .Hooks .Prestart {
918
- if hook .Path == preStartHook .Path {
919
- g .spec .Hooks .Prestart [i ] = preStartHook
920
- return nil
921
- }
922
- }
923
917
g .spec .Hooks .Prestart = append (g .spec .Hooks .Prestart , preStartHook )
924
918
return nil
925
919
}
@@ -935,12 +929,6 @@ func (g *Generator) ClearPostStopHooks() {
935
929
// AddPostStopHook adds a poststop hook into g.spec.Hooks.Poststop.
936
930
func (g * Generator ) AddPostStopHook (postStopHook rspec.Hook ) error {
937
931
g .initSpecHooks ()
938
- for i , hook := range g .spec .Hooks .Poststop {
939
- if hook .Path == postStopHook .Path {
940
- g .spec .Hooks .Poststop [i ] = postStopHook
941
- return nil
942
- }
943
- }
944
932
g .spec .Hooks .Poststop = append (g .spec .Hooks .Poststop , postStopHook )
945
933
return nil
946
934
}
@@ -956,12 +944,6 @@ func (g *Generator) ClearPostStartHooks() {
956
944
// AddPostStartHook adds a poststart hook into g.spec.Hooks.Poststart.
957
945
func (g * Generator ) AddPostStartHook (postStartHook rspec.Hook ) error {
958
946
g .initSpecHooks ()
959
- for i , hook := range g .spec .Hooks .Poststart {
960
- if hook .Path == postStartHook .Path {
961
- g .spec .Hooks .Poststart [i ] = postStartHook
962
- return nil
963
- }
964
- }
965
947
g .spec .Hooks .Poststart = append (g .spec .Hooks .Poststart , postStartHook )
966
948
return nil
967
949
}
0 commit comments