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

Non-conforming ignition file validates as OK, yet ignition complains about "unsupported config version" #2546

Open
arizvisa opened this Issue Jan 27, 2019 · 7 comments

Comments

Projects
None yet
3 participants
@arizvisa
Copy link

arizvisa commented Jan 27, 2019

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:," }
      }
    ]
  }
}
@bgilbert

This comment has been minimized.

Copy link
Member

bgilbert commented Jan 28, 2019

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.

@arizvisa

This comment has been minimized.

Copy link
Author

arizvisa commented Jan 28, 2019

It's pretty interesting that the online validator isn't using ignition-validate.

@arithx

This comment has been minimized.

Copy link

arithx commented Jan 28, 2019

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

@arizvisa

This comment has been minimized.

Copy link
Author

arizvisa commented Jan 28, 2019

Oh gotcha. I'll move my issue there. Thanks for the heads up

@arizvisa arizvisa closed this Jan 28, 2019

@arizvisa arizvisa reopened this Jan 28, 2019

@arizvisa

This comment has been minimized.

Copy link
Author

arizvisa commented Jan 28, 2019

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?

@bgilbert

This comment has been minimized.

Copy link
Member

bgilbert commented Jan 28, 2019

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.

@arizvisa

This comment has been minimized.

Copy link
Author

arizvisa commented Jan 29, 2019

Kk. Will do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment