You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Add context to preflight check messages (#1210)
**What problem does this PR solve?**:
Adds more context to preflight check messages.
The storage container check now returns a specific error when we find two storage containers with the same name in the same Prism Central cluster. That should never happen, since storage container names are unique within a Prism Central cluster.
**Which issue(s) this PR fixes**:
Fixes #
**How Has This Been Tested?**:
<!--
Please describe the tests that you ran to verify your changes.
Provide output from the tests and any manual steps needed to replicate
the tests.
-->
**Special notes for your reviewer**:
<!--
Use this to provide any additional information to the reviewers.
This may include:
- Best way to review the PR.
- Where the author wants the most review attention on.
- etc.
-->
"Registry URL scheme %q is not supported. Use http or https.",
105
+
"The registry URL %q uses the scheme %q. This scheme is not supported. Use either the \"http\" or \"https\" scheme.", ///nolint:lll // Message is long.
Message: "Failed to get Registry credentials Secret \"test-secret\": fake error. This is usually a temporary error. Please retry.", ///nolint:lll // Message is long.
139
+
Field: "cluster.spec.topology.variables[.name=clusterConfig].value.globalImageRegistryMirror.credentials.secretRef", //nolint:lll // Field is long.
Message: "Failed to parse registry URL \"invalid-url\" with error: parse \"invalid-url\": invalid URI for request. Review the Cluster.", ///nolint:lll // Message is long.
Message: "Registry URL scheme \"tcp\"is not supported. Use http or https.",
343
+
Message: "The registry URL \"tcp://some-registry.lol\" uses the scheme \"tcp\". This scheme is not supported. Use either the \"http\" or \"https\" scheme.",///nolint:lll // Message is long.
Message: "Failed to unmarshal cluster variable clusterConfig: failed to unmarshal json: invalid character 'i' looking for beginning of object key string",
109
+
Message: "Failed to unmarshal cluster variable \"clusterConfig\": failed to unmarshal json: invalid character 'i' looking for beginning of object key string. Review the Cluster.", ///nolint:lll // The message is long.
Field: "$.spec.topology.variables[[email protected]==\"clusterConfig\"].value.nutanix.prismCentralEndpoint.credentials.secretRef", ///nolint:lll // Field is long.
Field: "$.spec.topology.variables[[email protected]==\"clusterConfig\"].value.nutanix.prismCentralEndpoint.credentials.secretRef", ///nolint:lll // Field is long.
Message: fmt.Sprintf("Failed to parse Prism Central credentials: %s", err),
154
-
Field: "$.spec.topology.variables[[email protected]==\"clusterConfig\"].value.nutanix.prismCentralEndpoint.credentials.secretRef", ///nolint:lll // Field is long.
159
+
Message: fmt.Sprintf(
160
+
"Failed to parse Prism Central credentials: %s. Review the Secret.", ///nolint:lll // Message is long.
161
+
err,
162
+
),
163
+
Field: "$.spec.topology.variables[[email protected]==\"clusterConfig\"].value.nutanix.prismCentralEndpoint.credentials.secretRef", ///nolint:lll // Field is long.
Message: fmt.Sprintf("Failed to initialize Nutanix client: %s", err),
177
-
Field: "$.spec.topology.variables[[email protected]==\"clusterConfig\"].value.nutanix.prismCentralEndpoint.credentials.secretRef", ///nolint:lll // Field is long.
185
+
Message: fmt.Sprintf(
186
+
"Failed to initialize the Nutanix Prism Central API client: %s.", ///nolint:lll // Message is long.",
187
+
err,
188
+
),
189
+
Field: "$.spec.topology.variables[[email protected]==\"clusterConfig\"].value.nutanix.prismCentralEndpoint.credentials.secretRef", ///nolint:lll // Field is long.
Message: fmt.Sprintf("Failed to validate credentials using the v3 API client: %s", err),
196
-
Field: "$.spec.topology.variables[[email protected]==\"clusterConfig\"].value.nutanix.prismCentralEndpoint.credentials.secretRef", ///nolint:lll // Field is long.
207
+
Message: fmt.Sprintf(
208
+
"Failed to validate credentials: %s. Please check the username and/or password.", ///nolint:lll // Message is long.
209
+
err,
210
+
),
211
+
Field: "$.spec.topology.variables[[email protected]==\"clusterConfig\"].value.nutanix.prismCentralEndpoint.credentials.secretRef", ///nolint:lll // Field is long.
assert.Contains(t, result.Causes[0].Message, "Failed to parse Prism Central endpoint URL")
77
+
assert.Contains(
78
+
t,
79
+
result.Causes[0].Message,
80
+
"Failed to parse the Prism Central endpoint URL \"not-a-url\": error parsing Prism Central URL: parse \"not-a-url\": invalid URI for request. Check the URL format and retry.", ///nolint:lll // Message is long.
Message: fmt.Sprintf("Expected to find 1 VM Image, found %d", len(images)),
57
-
Field: c.field+".image",
60
+
Message: fmt.Sprintf(
61
+
"Found %d VM Images in Prism Central that match identifier %q. There must be exactly 1 VM Image that matches this identifier. Remove duplicate VM Images, use a different VM Image, or identify the VM Image by its UUID, then retry.", ///nolint:lll // Message is long.
0 commit comments