Adapt to changes to generic etcd/registry

This commit is contained in:
Clayton Coleman
2015-02-11 18:36:10 -05:00
parent 23d199ded9
commit 8440310ea0
9 changed files with 24 additions and 45 deletions

View File

@@ -53,7 +53,7 @@ func (r *registry) ApplyStatus(ctx api.Context, usage *api.ResourceQuotaUsage) e
resourceQuota := obj.(*api.ResourceQuota)
resourceQuota.ResourceVersion = usage.ResourceVersion
resourceQuota.Status = usage.Status
return r.Update(ctx, resourceQuota.Name, resourceQuota)
return r.UpdateWithName(ctx, resourceQuota.Name, resourceQuota)
}
// NewEtcdRegistry returns a registry which will store ResourceQuota in the given helper

View File

@@ -104,7 +104,7 @@ func TestResourceQuotaCreate(t *testing.T) {
for name, item := range table {
fakeClient, registry := NewTestLimitRangeEtcdRegistry(t)
fakeClient.Data[path] = item.existing
err := registry.Create(ctx, key, item.toCreate)
err := registry.CreateWithName(ctx, key, item.toCreate)
if !item.errOK(err) {
t.Errorf("%v: unexpected error: %v, %v", name, err, path)
}

View File

@@ -65,7 +65,7 @@ func (rs *REST) Create(ctx api.Context, obj runtime.Object) (runtime.Object, err
}
api.FillObjectMetaSystemFields(ctx, &resourceQuota.ObjectMeta)
err := rs.registry.Create(ctx, resourceQuota.Name, resourceQuota)
err := rs.registry.CreateWithName(ctx, resourceQuota.Name, resourceQuota)
if err != nil {
return nil, err
}
@@ -100,7 +100,7 @@ func (rs *REST) Update(ctx api.Context, obj runtime.Object) (runtime.Object, boo
return nil, false, errors.NewInvalid("resourceQuota", editResourceQuota.Name, errs)
}
if err := rs.registry.Update(ctx, editResourceQuota.Name, editResourceQuota); err != nil {
if err := rs.registry.UpdateWithName(ctx, editResourceQuota.Name, editResourceQuota); err != nil {
return nil, false, err
}
out, err := rs.registry.Get(ctx, editResourceQuota.Name)
@@ -117,7 +117,7 @@ func (rs *REST) Delete(ctx api.Context, name string) (runtime.Object, error) {
if !ok {
return nil, fmt.Errorf("invalid object type")
}
return &api.Status{Status: api.StatusSuccess}, rs.registry.Delete(ctx, name)
return rs.registry.Delete(ctx, name)
}
// Get gets a ResourceQuota with the specified name