Throw an API error when deleting namespace in termination

This commit is contained in:
derekwaynecarr 2015-05-05 12:49:51 -04:00
parent 9927a85cdc
commit d6a4b2427a

View File

@ -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)