Merge pull request #7780 from derekwaynecarr/incorrect_error

Throw an API error when deleting namespace in termination
pull/6/head
Clayton Coleman 2015-05-05 15:17:46 -04:00
commit 6e031ae01a
1 changed files with 2 additions and 1 deletions

View File

@ -21,6 +21,7 @@ import (
"path" "path"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api" "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
apierrors "github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors"
"github.com/GoogleCloudPlatform/kubernetes/pkg/fields" "github.com/GoogleCloudPlatform/kubernetes/pkg/fields"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" "github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/generic" "github.com/GoogleCloudPlatform/kubernetes/pkg/registry/generic"
@ -101,7 +102,7 @@ func (r *REST) Delete(ctx api.Context, name string, options *api.DeleteOptions)
// prior to final deletion, we must ensure that finalizers is empty // prior to final deletion, we must ensure that finalizers is empty
if len(namespace.Spec.Finalizers) != 0 { if len(namespace.Spec.Finalizers) != 0 {
err = fmt.Errorf("Namespace %v termination is in progress, waiting for %v", namespace.Name, namespace.Spec.Finalizers) err = apierrors.NewConflict("Namespace", namespace.Name, fmt.Errorf("Termination is in progress, waiting for %v", namespace.Spec.Finalizers))
return nil, err return nil, err
} }
return r.Etcd.Delete(ctx, name, nil) return r.Etcd.Delete(ctx, name, nil)