The linter found staticcheck and errorcheck issues. Deferred statements now use join to combine any new error with an existing one, preventing error information from being lost. Other minor error checks, like for printing text and flushing data have also been addressed.
Bumps the import path to be `github.com/coreos/ignition/v2`, this is
required to be able to import the v2 of Ignition alongside v0 in other
repositories.
Rework the schema to have all leaf fields be pointer except keys and all
interior nodes not be pointers.
This allows child configs to distinguish between an unspecified field
and a field specified as the go zero value.
This includes making storage.files.contents a normal (non pointer)
struct but making all of its members pointers. Similarly,
storage.files.{user,group} are no longer pointers but
storage.files.{user,group}.name are now pointers.
Finally, convert validation logic to use report.AddOnError() and friends
where appropriate.
Certain fields it makes sense to allow duplicates, like ones where there
are args being passed to a utility program. Allow exempting lists for
duplicate checking and exempt file appends, raid options and fs creation
options.
Check that no duplicates exist in the config's lists. Check that
files/link/dirs don't have duplicates across lists
There is a special case here: lists of strings implicitly use the string
as its Key(). This is just a shortcut, we can drop it later if we need
to in favor of explicit Key() functions.
- config package should have a Parse() function that accepts any
supported version of the config
- each version package (i.e. config/v3_0_experimental) should only
accept configs of that version
- In the future translation code should be its own subpackage to each
config version package (i.e. under config/vX_Y/translate)
- In the future the config package should handle calling the
translation code explicitly instead of each version package. This
removes the need to vendor more than 1 version if that's all you need.
- Remove filesystem names, make path be the mount path to use in the
initramfs
- Simplify symlink handling now that everything is under /sysroot
- Update unit tests
go4.org's errorutil doesn't handle tabs correctly. It also takes a
io.Reader which meant we had to constantly wrap our byte slices. Replace
it with our own implementation that accepts a []byte and replaces tabs
with spaces.
This adds a warning to all config versions for an enabled unit with no
install section.
In general, any unit that has contents, is enabled, but has no install
section is useless.
It's unlikely a user intends to ever write such a unit, even if
technically the install section could be in a drop-in.
To avoid duplication, this also introduces a new 'shared' package under
'config'
Having 'util' import 'validate' makes it very easy to hit import cycles,
e.g. if you try to use a 'util' helper function in validate or validate
tests.
Validation seems like it fits better in the validate package anyways.
When Ignition switched to using a json schema the validation logic
changed slightly to allow Validate<FieldName>() functions to be called
as well. Ignition did not try to get the corrosponding ast node for that
field. This lets Ignition try to get the corrosponding ast node.
Add option to not generate unused key warnings. This is used for clct to
validate the portions where the configurations are the same but not warn
about the addition entries in the clct configuration.