Non-conforming ignition file validates as OK, yet ignition complains about "unsupported config version"
Issue Report
The ignition json at the end of this document validates as okay, but if you look carefuly the "mode" is quoted as a string when it should be an integer. When ignition actually gets to the file, ignition then complains about the ignition file being of an unsupported version. This is confusing because the schema version is included in the json, yet ignition is actually complaining about the json being incorrectly formatted.
Bug
The "mode" field under "files" should be validated as an integer and not a string.
In all actuality, the ignition validation at https://coreos.com/validate/ doesn't
even bother to validate the mode at all. You can even place a list or an object
as "mode" and it congratulates you.
Container Linux Version
This is in current.
COREOS_BUILD=1967
COREOS_BRANCH=3
COREOS_PATCH=0
COREOS_VERSION=1967.3.0
COREOS_VERSION_ID=1967.3.0
COREOS_BUILD_ID="2019-01-08-0032"
COREOS_SDK_VERSION=1967.2.0
Expected Behavior
CoreOS validator should actually validate the values of different fields in the json schema.
For ignition, instead of mentioning that there's an unsupported version error during parsing, it would be better to distinguish between a parsing error and the unsupported version. Better yet, if there's a parsing error it'd be nice if it mentioned information about what it was expecting and perhaps the key it was currently trying to validate.
Actual Behavior
CoreOS' validator is super friendly and comforts you with everything being okay.
Ignition complains about the ignition file being of an unsupported version and gives you the option to boot into an emergency shell pre-switch-root.
Ignition file
{
"ignition": {
"version": "2.2.0"
},
"storage": {
"files": [
{
"filesystem": "root",
"path": "/path/to/whatever",
"mode": "420",
"contents": { "source": "data:," }
}
]
}
}
ignition-validate says:
error at line 10, column 22
9: "path": "/path/to/whatever",
10: "mode": "420"
^
json: cannot unmarshal string into Go value of type int
So the validation problem is specific to the online validator.
It's pretty interesting that the online validator isn't using ignition-validate.
The online validator existed before the ignition-validate command was created. It's code can be viewed here: https://github.com/coreos/container-linux-userdata-validator
Oh gotcha. I'll move my issue there. Thanks for the heads up
Um, Lol. So I can't create issues there. Since this isn't coreos-related and actually related to the online validator, is there a better place to put this issue?
This is the right place for the validator issue. Many of our repos don't currently have separate bug trackers.
So it seems there are two issues:
- Online validator not validating
- Ignition not properly reporting the parse error
The latter would best go in coreos/ignition, if you'd be willing to file a bug over there.
Kk. Will do.