-
Notifications
You must be signed in to change notification settings - Fork 102
Don't Unmarshal edpm_services_override #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
|
[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 |
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.
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.
My thinking in just dropping it is that the field value has already been validated as part of the Spec. It should marshal back to JSON just fine (in theory of course). Given we drop possible errors all over the place with "_", it felt ok to use that pattern again here.
|
@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. |
7c6ab83 to
591a484
Compare
|
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/24dbbf32511c44aea579605a3a25aaf4 ✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 15m 55s |
|
tempest: Unrelated by the looks of it.. |
d90cf64 to
3b9e417
Compare
3b9e417 to
8cc52ca
Compare
|
/retest |
edpm_services_override is already marshal'd to JSON in ansible_execution.go, so there's no need to unmarshal and print it to string, b/c go drops the commas from the marshal'd value. 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>
8cc52ca to
76b0085
Compare
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