Skip to content

Fix Azure ARM create_node JSON error with ex_customdata (#1893)#2159

Open
Sanjays2402 wants to merge 1 commit into
apache:trunkfrom
Sanjays2402:fix/azure-arm-customdata-1893
Open

Fix Azure ARM create_node JSON error with ex_customdata (#1893)#2159
Sanjays2402 wants to merge 1 commit into
apache:trunkfrom
Sanjays2402:fix/azure-arm-customdata-1893

Conversation

@Sanjays2402

@Sanjays2402 Sanjays2402 commented Jul 19, 2026

Copy link
Copy Markdown

Description

Fixes #1893.

For the Azure ARM driver, create_node failed when ex_customdata was provided:

  • base64.b64encode() returns bytes, which is not JSON serializable, so building the request body raised Object of type bytes is not JSON serializable.
  • Passing ex_customdata as a str also failed because b64encode requires bytes-like input.

The fix normalizes ex_customdata to bytes, then decodes the base64 result to a UTF-8 str so customData is JSON-serializable. Both str and bytes inputs are now accepted.

Status

  • done, ready for review

Checklist (tick everything that applies)

  • Code linting (required, can be done after the PR checks) — black --check and flake8 clean on changed files
  • Documentation
  • Tests — added test_create_node_ex_customdata (str + bytes); fails without the fix, passes with it; full test_azure_arm.py = 46 passed
  • ICLA (required for bigger changes) — small bugfix

base64.b64encode returns bytes, which is not JSON serializable and
raised 'Object of type bytes is not JSON serializable' when
ex_customdata was passed to create_node. It also failed outright when
ex_customdata was a str. The value is now normalized to bytes before
encoding and the base64 result is decoded to a str so the resulting
request body is valid JSON.

Closes: GITHUB-1893
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Azure arm ex_customdata causes json error

1 participant