@@ -31,7 +31,6 @@ type BuildConfigReaper struct {
31
31
// Stop deletes the build configuration and all of the associated builds.
32
32
func (reaper * BuildConfigReaper ) Stop (namespace , name string , timeout time.Duration , gracePeriod * kapi.DeleteOptions ) error {
33
33
noBcFound := false
34
- noBuildFound := true
35
34
36
35
// Add deletion pending annotation to the build config
37
36
err := unversioned .RetryOnConflict (unversioned .DefaultRetry , func () error {
@@ -60,6 +59,10 @@ func (reaper *BuildConfigReaper) Stop(namespace, name string, timeout time.Durat
60
59
return err
61
60
}
62
61
62
+ if noBcFound {
63
+ return kerrors .NewNotFound (buildapi .Resource ("buildconfig" ), name )
64
+ }
65
+
63
66
// Warn the user if the BuildConfig won't get deleted after this point.
64
67
bcDeleted := false
65
68
defer func () {
@@ -84,7 +87,6 @@ func (reaper *BuildConfigReaper) Stop(namespace, name string, timeout time.Durat
84
87
}
85
88
}
86
89
}
87
- noBuildFound = false
88
90
if err := reaper .oc .Builds (namespace ).Delete (build .Name ); err != nil {
89
91
glog .Warningf ("Cannot delete Build %s/%s: %v" , build .Namespace , build .Name , err )
90
92
if ! kerrors .IsNotFound (err ) {
@@ -100,7 +102,6 @@ func (reaper *BuildConfigReaper) Stop(namespace, name string, timeout time.Durat
100
102
return err
101
103
}
102
104
for _ , build := range builds .Items {
103
- noBuildFound = false
104
105
if err := reaper .oc .Builds (namespace ).Delete (build .Name ); err != nil {
105
106
glog .Warningf ("Cannot delete Build %s/%s: %v" , build .Namespace , build .Name , err )
106
107
if ! kerrors .IsNotFound (err ) {
@@ -122,9 +123,5 @@ func (reaper *BuildConfigReaper) Stop(namespace, name string, timeout time.Durat
122
123
}
123
124
bcDeleted = true
124
125
125
- if noBcFound && noBuildFound {
126
- return kerrors .NewNotFound (buildapi .Resource ("buildconfig" ), name )
127
- }
128
-
129
126
return nil
130
127
}
0 commit comments