From 2d98fa2e04761926b87026cf83af459ffe154ebd Mon Sep 17 00:00:00 2001 From: Christopher Schmitt Date: Tue, 17 Oct 2023 19:36:06 -0600 Subject: [PATCH] fix: ensure HumioVersion constaint parses successfully Fixes #747 --- controllers/humiocluster_version.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/controllers/humiocluster_version.go b/controllers/humiocluster_version.go index 50c6bda6..b4365294 100644 --- a/controllers/humiocluster_version.go +++ b/controllers/humiocluster_version.go @@ -64,7 +64,11 @@ func (hv *HumioVersion) IsLatest() bool { func (hv *HumioVersion) constraint(constraintStr string) (bool, error) { constraint, err := semver.NewConstraint(constraintStr) - return constraint.Check(hv.version), err + if err != nil { + return false, fmt.Errorf("could not parse constraint of `%s`: %w", constraintStr, err) + } + + return constraint.Check(hv.version), nil } func (hv *HumioVersion) String() string {