Merge pull request #3029 from ddysher/get-err-code

Fix node Get() error code
pull/6/head
bgrant0607 2014-12-18 09:52:45 -08:00
commit 0892fd3d6d
3 changed files with 7 additions and 1 deletions

View File

@ -604,7 +604,7 @@ func (r *Registry) GetMinion(ctx api.Context, minionID string) (*api.Node, error
key := makeNodeKey(minionID)
err := r.ExtractObj(key, &minion, false)
if err != nil {
return nil, etcderr.InterpretGetError(err, "minion", minion.Name)
return nil, etcderr.InterpretGetError(err, "minion", minionID)
}
return &minion, nil
}

View File

@ -40,6 +40,9 @@ func NewHealthyRegistry(delegate Registry, client client.KubeletHealthChecker) R
func (r *HealthyRegistry) GetMinion(ctx api.Context, minionID string) (*api.Node, error) {
minion, err := r.delegate.GetMinion(ctx, minionID)
if err != nil {
return minion, err
}
if minion == nil {
return nil, ErrDoesNotExist
}

View File

@ -86,6 +86,9 @@ func (rs *REST) Delete(ctx api.Context, id string) (<-chan apiserver.RESTResult,
// Get satisfies the RESTStorage interface.
func (rs *REST) Get(ctx api.Context, id string) (runtime.Object, error) {
minion, err := rs.registry.GetMinion(ctx, id)
if err != nil {
return minion, err
}
if minion == nil {
return nil, ErrDoesNotExist
}