Skip to content

Fix neutron-adoption with ironic#1371

Open
gthiemonge wants to merge 1 commit intoopenstack-k8s-operators:mainfrom
gthiemonge:fix_neutron_adoption
Open

Fix neutron-adoption with ironic#1371
gthiemonge wants to merge 1 commit intoopenstack-k8s-operators:mainfrom
gthiemonge:fix_neutron_adoption

Conversation

@gthiemonge
Copy link
Copy Markdown
Contributor

Fix a conversion issue in neutron-adoption, the task triggers a bug:

[..]
oc patch openstackcontrolplane openstack --type=merge --patch '{'spec': {'neutron': {'template': {'ml2MechanismDrivers': ['ovn', 'baremetal']}}}}' Error from server (BadRequest): error decoding patch: invalid character 's' looking for beginning of object key string [..]

ironic_ml2_baremetal_patch is an ansible object, it needs to be converted to a json string before it's used in an oc patch command

Fix a conversion issue in neutron-adoption, the task triggers a bug:

[..]
oc patch openstackcontrolplane openstack --type=merge --patch '{'spec': {'neutron': {'template': {'ml2MechanismDrivers': ['ovn', 'baremetal']}}}}'
Error from server (BadRequest): error decoding patch: invalid character 's' looking for beginning of object key string
[..]

ironic_ml2_baremetal_patch is an ansible object, it needs to be
converted to a json string before it's used in an oc patch command
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Apr 28, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign jistr for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@gthiemonge
Copy link
Copy Markdown
Contributor Author

@hjensas ^ FYI I'm testing it in a D/S CI job

@jistr
Copy link
Copy Markdown
Contributor

jistr commented Apr 28, 2026

I guess it's a problem of single quotes within single quotes, and to_json makes double quotes instead. (json.dumps does that and according to docs, the filter uses that function under the hood)

So this is not resilient to single quotes appearing inside the patch in a string, but since this is testing only, i think it's ok and should fix the mentioned problem.

/lgtm

@gthiemonge
Copy link
Copy Markdown
Contributor Author

I guess it's a problem of single quotes within single quotes, and to_json makes double quotes instead. (json.dumps does that and according to docs, the filter uses that function under the hood)

So this is not resilient to single quotes appearing inside the patch in a string, but since this is testing only, i think it's ok and should fix the mentioned problem.

/lgtm

another method would be the use of raw text that represents a yaml doc, for instance for neutron_config_patch:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants