Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NO-ISSUE: Ensure that
openshift_version
isn't empty
We found a situation where the `openshift_version` column of the clusters table is empty. We haven't been able to understand why, but it results in an error when running validations. For example, the dual-stack VIP validation produces a false negative: ``` 2024-09-11T05:39:04.055138029Z time="2024-09-11T05:39:04Z" level=error msg="Cluster 686c7849-8d68-4340-b81d-9add8c4261fe failed VIP validations" func="github.com/openshift/assisted-service/internal/bminventory.(*bareMetalInventory).validateAndUpdateClusterParams" file="/remote-source/assisted-service/app/internal/bminventory/inventory.go:1889" error="dual-stack VIPs are not supported in OpenShift " pkg=Inventory ``` Note how the error message doesn't contain the OpenShift version at the end. It should, as the code is like this: ```go return common.NewApiError(http.StatusBadRequest, errors.Errorf("%s %s", "dual-stack VIPs are not supported in OpenShift", cluster.OpenshiftVersion)) ``` So we are assuming, at least in that code, that the `openshift_version` column is not empty. This patch changes adds a database constraint to ensure that that `openshift_column` isn't null or empty. That doesn't address the root cause (because we don't know it) but at least it should catch situations where something tries to set that column empty. Related: https://issues.redhat.com/browse/OCPBUGS-42059 Related: https://github.com/openshift/assisted-service/blob/e59df80246f418b62048d7252e4d79bf5723c81e/internal/cluster/validations/validations.go#L256 Signed-off-by: Juan Hernandez <juan.hernandez@redhat.com>
- Loading branch information