Error `One or more the json documents could not be parsed. Run jgrep -v for to display documents`
bastelfreak opened this issue · comments
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.
Yeah, we have tests that ensure that all the committed fact sets contain valid JSON, which makes this smell like a jgrep issue.
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!)