Skip to content
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 to ignore unquoted strings #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eliaoggian
Copy link

The script was throwing the following error:

[root@naret-monitor01 ~]# ./upmap-remapped.py
Traceback (most recent call last):
 File "./upmap-remapped.py", line 112, in <module>
   osd_dump = json.loads(osd_dump_json)
 File "/usr/lib64/python3.6/json/__init__.py", line 354, in loads
   return _default_decoder.decode(s)
 File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode
   obj, end = self.raw_decode(s, idx=_w(s, 0).end())
 File "/usr/lib64/python3.6/json/decoder.py", line 357, in raw_decode
   raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 105 column 25 (char 3099)

The output of ceph osd dump -f json | jq -r contained two lines with unquoted strings.

        "score_acting": DBL_MAX,
        "score_stable": DBL_MAX,

As these lines should not be relevant for the script purpose, this change will delete them to allow the correct parsing of the JSON.

@dvanders
Copy link
Collaborator

Thanks @eliaoggian for this.
These type of issues keep cropping up. I sure wish there was a json library or linter we could use that makes the ceph output parseable.

@eliaoggian
Copy link
Author

Yes, even tough I guess the best thing would be to have ceph code producing a valid JSON output straight from the beginning instead of fixing it afterwards 😄

@dvanders
Copy link
Collaborator

@eliaoggian thanks for this. could you please check if you still need this after we merged #42 ?

@eliaoggian
Copy link
Author

Yes, it still fails as there are the unquoted strings.

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.

2 participants