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

Error One or more the json documents could not be parsed. Run jgrep -v for to display documents #148

Open
bastelfreak opened this issue Feb 8, 2020 · 3 comments · Fixed by ploubser/JSON-Grep#44

Comments

@bastelfreak
Copy link
Member

Hi people,

At Vox Pupuli we recently got a PR to add Windows support. That PR also added several windows operating systems to the metadata.json:

diff --git a/metadata.json b/metadata.json
index e5ccd8c..e9502ad 100644
--- a/metadata.json
+++ b/metadata.json
@@ -151,6 +151,15 @@
         "9",
         "10"
       ]
+    },
+    {
+      "operatingsystem": "windows",
+      "operatingsystemrelease": [
+        "2008R2",
+        "2012",
+        "2012R2",
+        "2016"
+      ]
     }
   ]
 }

Since that we also see the following messages in travis runs:

One or more the json documents could not be parsed. Run jgrep -v for to display documents

My wild guess is that some of those facts are broken? However I tested them with jq and they all seem to contain valid JSON.

@rodjek
Copy link
Member

rodjek commented Feb 27, 2020

Yeah, we have tests that ensure that all the committed fact sets contain valid JSON, which makes this smell like a jgrep issue.

@rodjek
Copy link
Member

rodjek commented Feb 27, 2020

It is indeed a bug in jgrep. When it tries to convert certain values before comparing, it uses a regex with an unescaped . and so it thinks that 2012R2 is a float and tries to convert it, leading to it raising an error Error - invalid value for Float(): "2012R2" which it unfortunately swallows and presents as a generic "invalid JSON" error.

I'll open a PR on jgrep to get it fixed upstream.

In the meantime, you should change your operatingsystemrelease values so that 2008R2 and 2012R2 become 2008 R2 and 2012 R2 as those is the correct values to use (and as a bonus it contains 2 non-digit characters and so doesn't match the incorrect regex, avoiding that jgrep bug!)

rodjek added a commit to rodjek/JSON-Grep that referenced this issue Feb 27, 2020
So that it doesn't match strings like `2012R2` as a float.

Fixes voxpupuli/facterdb#148
@yakatz
Copy link
Contributor

yakatz commented May 16, 2024

Still relevant?

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 a pull request may close this issue.

3 participants