-
-
Notifications
You must be signed in to change notification settings - Fork 750
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
Fix st2client @key=file_path.json notation for specifying complex objects in a file #5140
Conversation
Previously it was broken, because it didn't correctly convert bytes to string which means all data would have b"" prefix which would break JSON and other parsing. This bug was likely introduced when adding support for Python 3.
I've added tests for it (32d3c8d) and verified the functionality was indeed never meant to be used with binary data, but only string data. In theory, we could probably also make it support binary data, but this would likely also require changes in the http layer (client, API) and I don't think anyone requests something like that before. |
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.
That's a good find.
I bet we have more dark rarely used corners like that.
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.
LGTM. I haven't looked at Travis to see why it's failing.
I can't restart the Travis-CI job for some HTTP 403 reason. I tried signing out of Travis and back in, same result. @Kami Can you try restarting the Travis build? |
Lint check is failing and it doesn't appear to be related to any of my changes:
It seems more pylint related - e.g. our custom pylint plugin not running or similar. |
I tried to use
st2 run @param=file_path.json
notation to specify complex JSON parameter value in a file.It turns out it's not working correctly. Using
--debug
flag it shows it's not correctly converting bytes to unicode which means JSON serialization fails (actual value hasb""
prefix which indicates that code is incorrectly callingstr()
on the value somewhere instead of usingbytes.decode()
).This pull request fixes that.
TODO