Updates to review comments

This commit is contained in:
derekwaynecarr
2014-10-01 10:42:07 -04:00
parent f3859394ab
commit 6625e58a20
6 changed files with 27 additions and 23 deletions

View File

@@ -17,7 +17,6 @@ limitations under the License.
package pod
import (
stderrs "errors"
"fmt"
"sync"
"time"
@@ -70,8 +69,8 @@ func NewREST(config *RESTConfig) *REST {
func (rs *REST) Create(ctx api.Context, obj runtime.Object) (<-chan runtime.Object, error) {
pod := obj.(*api.Pod)
if !api.ValidNamespaceOnCreateOrUpdate(ctx, &pod.JSONBase) {
return nil, errors.NewConflict("pod", pod.Namespace, stderrs.New("Pod.Namespace does not match the provided context"))
if !api.ValidNamespace(ctx, &pod.JSONBase) {
return nil, errors.NewConflict("pod", pod.Namespace, fmt.Errorf("Pod.Namespace does not match the provided context"))
}
pod.DesiredState.Manifest.UUID = uuid.NewUUID().String()
if len(pod.ID) == 0 {
@@ -162,8 +161,8 @@ func (*REST) New() runtime.Object {
func (rs *REST) Update(ctx api.Context, obj runtime.Object) (<-chan runtime.Object, error) {
pod := obj.(*api.Pod)
if !api.ValidNamespaceOnCreateOrUpdate(ctx, &pod.JSONBase) {
return nil, errors.NewConflict("pod", pod.Namespace, stderrs.New("Pod.Namespace does not match the provided context"))
if !api.ValidNamespace(ctx, &pod.JSONBase) {
return nil, errors.NewConflict("pod", pod.Namespace, fmt.Errorf("Pod.Namespace does not match the provided context"))
}
if errs := validation.ValidatePod(pod); len(errs) > 0 {
return nil, errors.NewInvalid("pod", pod.ID, errs)