Skip to content

Commit

Permalink
Don't log-and-return error
Browse files Browse the repository at this point in the history
It's enough for the caller to process the error, no need to log it.

Signed-off-by: Tom Wieczorek <twieczorek@mirantis.com>
  • Loading branch information
twz123 committed Jun 18, 2024
1 parent 81e5c16 commit 1dc4f54
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions inttest/ap-removedapis/removedapis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func (s *plansRemovedAPIsSuite) TestApply() {
plan, err := aptest.WaitForPlanState(s.Context(), client, apconst.AutopilotName, appc.PlanWarning)
if s.NoError(err) && s.Len(plan.Status.Commands, 1) {
s.Equal(appc.PlanWarning, plan.Status.Commands[0].State)
s.Equal("removedcrds.autopilot.k0sproject.io v1beta1 has been removed in Kubernetes v99.99.99, but there are 1 such resources in the cluster", plan.Status.Commands[0].Description)
}
}

Expand Down
4 changes: 1 addition & 3 deletions pkg/autopilot/checks/checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@ func CanUpdate(log logrus.FieldLogger, clientFactory kubernetes.ClientFactoryInt
}
}
if found > 0 {
err = fmt.Errorf("%s is removed in Kubernetes %s. There are %d resources of the type in the cluster", gvk.String(), semver.MajorMinor(newVersion), found)
logrus.Error(err)
return err
return fmt.Errorf("%s.%s %s has been removed in Kubernetes %s, but there are %d such resources in the cluster", ar.Name, gv.Group, gv.Version, removedInVersion, found)
}
}
}
Expand Down

0 comments on commit 1dc4f54

Please sign in to comment.