Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #3033 from dgibson/bug3032
Browse files Browse the repository at this point in the history
Fix some error reporting in listInterfaces() and listRoutes()
  • Loading branch information
dgibson committed Oct 31, 2020
2 parents 131e3b4 + 0ffaeeb commit c54378d
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions virtcontainers/kata_agent.go
Expand Up @@ -672,13 +672,10 @@ func (k *kataAgent) listInterfaces() ([]*vcTypes.Interface, error) {
return nil, err
}
resultInterfaces, ok := resultingInterfaces.(*grpc.Interfaces)
if ok {
ifaces, err := k.convertToInterfaces(resultInterfaces.Interfaces)
if err == nil {
return ifaces, nil
}
if !ok {
return nil, fmt.Errorf("Unexpected type %T for interfaces", resultingInterfaces)
}
return nil, err
return k.convertToInterfaces(resultInterfaces.Interfaces)
}

func (k *kataAgent) listRoutes() ([]*vcTypes.Route, error) {
Expand All @@ -688,10 +685,10 @@ func (k *kataAgent) listRoutes() ([]*vcTypes.Route, error) {
return nil, err
}
resultRoutes, ok := resultingRoutes.(*grpc.Routes)
if ok {
return k.convertToRoutes(resultRoutes.Routes), err
if !ok {
return nil, fmt.Errorf("Unexpected type %T for routes", resultingRoutes)
}
return nil, err
return k.convertToRoutes(resultRoutes.Routes), nil
}

func (k *kataAgent) startProxy(sandbox *Sandbox) error {
Expand Down

0 comments on commit c54378d

Please sign in to comment.