upmap: Add basic/empty filter to jq and fix Python string/JSON issue #41
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.
Hello everyone!
First and foremost, I would like to thank you for creating this script - it's incredibly helpful in my daily work!
A few months ago, I started having issues with the
upmap-remapped.py
script (on Ubuntus 16.04 - 20.04, Cephs 14-16).I quickly discovered that the issue occurred due to the recently added
jq
filtering. According to thejq
manual, it requires a filter, and the basic/empty filter is just a dot.
. The fix was trivial: adding a dot.
filter to alljq
commands resolved the issue, and the script started working again.A few tries/weeks later, I encountered another issue - Python was complaining that the JSON string wasn't correct and couldn't be decoded. I was surprised because the string had gone through
jq
, so it should have been correct. This issue occurred some time ago, so I can't provide all the details, but it was related to some special characters or sequence in the JSON string fromceph pg ls remapped
that was parsed by Python. I'm certain it was related to the issue described here: https://discuss.python.org/t/help-json-loads-cannot-parse-valid-json/12605But getting back to the point I fixed the Python string/JSON issue by converting the subprocess output to a "raw string" which was then correctly decoded by the JSON interpreter/decoder.