Fix Azure ARM create_node JSON error with ex_customdata (#1893)#2159
Merged
Conversation
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
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## trunk #2159 +/- ##
==========================================
+ Coverage 83.38% 83.39% +0.01%
==========================================
Files 351 351
Lines 81457 81476 +19
Branches 8745 8746 +1
==========================================
+ Hits 67919 67940 +21
+ Misses 10745 10744 -1
+ Partials 2793 2792 -1
🚀 New features to boost your workflow:
|
micafer
enabled auto-merge
July 20, 2026 08:07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #1893.
For the Azure ARM driver,
create_nodefailed whenex_customdatawas provided:base64.b64encode()returnsbytes, which is not JSON serializable, so building the request body raisedObject of type bytes is not JSON serializable.ex_customdataas astralso failed becauseb64encoderequires bytes-like input.The fix normalizes
ex_customdatatobytes, then decodes the base64 result to a UTF-8strsocustomDatais JSON-serializable. Bothstrandbytesinputs are now accepted.Status
Checklist (tick everything that applies)
black --checkandflake8clean on changed filestest_create_node_ex_customdata(str + bytes); fails without the fix, passes with it; fulltest_azure_arm.py= 46 passed