-
Notifications
You must be signed in to change notification settings - Fork 102
Marshal servicesOverride to JSON before formatting #1731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
go was formatting the servicesOverride slice without commas between the items, which causes the value to be interpreted as a YAML list of one string item. Marshal'ing the value to JSON first causes proper JSON syntax so that the resulting YAML value is properly formatted with commas. This was breaking the download-cache service that relies on the proper value of edpm_services_override when using download-cache and servicesOverride on a Deployment. Jira: OSPRH-21737 Signed-off-by: James Slagle <jslagle@redhat.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: slagle The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@slagle: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
bshephar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey man,
I couldn't open the Jira to see the full context of what the error was. But my suggestion is an implementation detail rather than a fixing the reported problem suggestion.
|
|
||
| if len(deployment.Spec.ServicesOverride) > 0 { | ||
| a.ExtraVars["edpm_services_override"] = json.RawMessage([]byte(fmt.Sprintf("\"%s\"", deployment.Spec.ServicesOverride))) | ||
| extraVarsJSON, _ := json.Marshal(deployment.Spec.ServicesOverride) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this err should probably be checked, no?
I understand that is complicated by the fact that this function doesn't return anything and changing the signature of the function isn't nice. It is only used in one place though, so probably not the end of the world to update the signature to:
func (a *EEJob) FormatAEEExtraVars(
aeeSpec *dataplanev1.AnsibleEESpec,
service *dataplanev1.OpenStackDataPlaneService,
deployment *dataplanev1.OpenStackDataPlaneDeployment,
nodeSet client.Object,
) error {
}
Which does also necessitate changing the signature of BuildAeeJobSpec to also return an error to facilitate back propagating the error. But I think it would probably be nicer if the error was captured and returned rather than silently dropped.
|
@bshephar: changing LGTM is restricted to collaborators DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
go was formatting the servicesOverride slice without commas between the
items, which causes the value to be interpreted as a YAML list of one
string item. Marshal'ing the value to JSON first causes proper JSON
syntax so that the resulting YAML value is properly formatted with
commas.
This was breaking the download-cache service that relies on the proper
value of edpm_services_override when using download-cache and
servicesOverride on a Deployment.
Jira: OSPRH-21737
Signed-off-by: James Slagle jslagle@redhat.com