ref(pkg/storage): Refactor Deployed and DeployedAll (#7374)

The error returned from DeployedAll will never contain "not found".

The error returned at the end of Deployed is already known to be nil,
and we never want to return ls[0] together with a non-nil error anyway.

Signed-off-by: Simon Alling <alling.simon@gmail.com>
pull/7358/head
Simon Alling 5 years ago committed by Martin Hickey
parent e84b61b2db
commit e868cb23c0

@ -112,9 +112,6 @@ func (s *Storage) ListDeployed() ([]*rspb.Release, error) {
func (s *Storage) Deployed(name string) (*rspb.Release, error) {
ls, err := s.DeployedAll(name)
if err != nil {
if strings.Contains(err.Error(), "not found") {
return nil, errors.Errorf("%q has no deployed releases", name)
}
return nil, err
}
@ -122,7 +119,7 @@ func (s *Storage) Deployed(name string) (*rspb.Release, error) {
return nil, errors.Errorf("%q has no deployed releases", name)
}
return ls[0], err
return ls[0], nil
}
// DeployedAll returns all deployed releases with the provided name, or

Loading…
Cancel
Save