From d6a4b2427ab226b3af97ac987cf3c87b21c17392 Mon Sep 17 00:00:00 2001 From: derekwaynecarr Date: Tue, 5 May 2015 12:49:51 -0400 Subject: [PATCH] Throw an API error when deleting namespace in termination --- pkg/registry/namespace/etcd/etcd.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/registry/namespace/etcd/etcd.go b/pkg/registry/namespace/etcd/etcd.go index bed2fab280..b9dfdcbfbb 100644 --- a/pkg/registry/namespace/etcd/etcd.go +++ b/pkg/registry/namespace/etcd/etcd.go @@ -21,6 +21,7 @@ import ( "path" "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/labels" "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 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 r.Etcd.Delete(ctx, name, nil)