Commit 677f68ec authored by Deyuan Deng's avatar Deyuan Deng

Fix node Get() error code

parent fd7b4d46
...@@ -604,7 +604,7 @@ func (r *Registry) GetMinion(ctx api.Context, minionID string) (*api.Node, error ...@@ -604,7 +604,7 @@ func (r *Registry) GetMinion(ctx api.Context, minionID string) (*api.Node, error
key := makeNodeKey(minionID) key := makeNodeKey(minionID)
err := r.ExtractObj(key, &minion, false) err := r.ExtractObj(key, &minion, false)
if err != nil { if err != nil {
return nil, etcderr.InterpretGetError(err, "minion", minion.Name) return nil, etcderr.InterpretGetError(err, "minion", minionID)
} }
return &minion, nil return &minion, nil
} }
......
...@@ -40,6 +40,9 @@ func NewHealthyRegistry(delegate Registry, client client.KubeletHealthChecker) R ...@@ -40,6 +40,9 @@ func NewHealthyRegistry(delegate Registry, client client.KubeletHealthChecker) R
func (r *HealthyRegistry) GetMinion(ctx api.Context, minionID string) (*api.Node, error) { func (r *HealthyRegistry) GetMinion(ctx api.Context, minionID string) (*api.Node, error) {
minion, err := r.delegate.GetMinion(ctx, minionID) minion, err := r.delegate.GetMinion(ctx, minionID)
if err != nil {
return minion, err
}
if minion == nil { if minion == nil {
return nil, ErrDoesNotExist return nil, ErrDoesNotExist
} }
......
...@@ -86,6 +86,9 @@ func (rs *REST) Delete(ctx api.Context, id string) (<-chan apiserver.RESTResult, ...@@ -86,6 +86,9 @@ func (rs *REST) Delete(ctx api.Context, id string) (<-chan apiserver.RESTResult,
// Get satisfies the RESTStorage interface. // Get satisfies the RESTStorage interface.
func (rs *REST) Get(ctx api.Context, id string) (runtime.Object, error) { func (rs *REST) Get(ctx api.Context, id string) (runtime.Object, error) {
minion, err := rs.registry.GetMinion(ctx, id) minion, err := rs.registry.GetMinion(ctx, id)
if err != nil {
return minion, err
}
if minion == nil { if minion == nil {
return nil, ErrDoesNotExist return nil, ErrDoesNotExist
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment