Bug #10282

[Go programs]Warn or error when unrecognized keys appear in config files

Added by Tom Clegg almost 3 years ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Assigned To:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Story points:
1.0

Description

Currently, if a configuration key is misspelled or misplaced in a configuration file, it is silently ignored.

Programs that read configuration files should print a warning message when this happens, to avoid running services with configuration different than intended. Support an optional flag which converts the warning to an error and causes the program to exit.

There is a Go feature in the works that would be helpful. Even with that, we'd still need our YAML library to expose DisallowUnknownFields() -- either that, or convert YAML → map[string]interface{} → JSON and then load the resulting JSON to the real struct using DisallowUnknownFields().

If we don't want to wait, we could detect invalid keys by comparing site config to example config (but do not read the example config from /etc at runtime -- rather, build the example config into the Go binary). Load both configs into a map[string]interface{}, then do a recursive "A's keys are a subset of B's keys" test.


Related issues

Related to Arvados - Feature #10594: [API] [Workbench] Error out when unrecognized keys appear in config filesNew11/22/2016

Related to Arvados - Story #15003: [config] Go package & tool for preprocessing cluster config fileResolved04/26/2019

Blocked by Arvados - Feature #10141: [Packaging] Include sample config file (/etc/arvados/foo/foo.example.yml) with each configurable packageClosed09/28/2016

History

#1 Updated by Tom Clegg almost 3 years ago

  • Description updated (diff)

#2 Updated by Tom Morris almost 3 years ago

  • Assigned To set to Tom Morris
  • Target version set to Arvados Future Sprints

#3 Updated by Tom Clegg over 2 years ago

  • Subject changed from Log a warning when unrecognized keys appear in config files to Error out when unrecognized keys appear in config files
  • Description updated (diff)

#4 Updated by Tom Clegg over 2 years ago

  • Description updated (diff)
  • Subject changed from Error out when unrecognized keys appear in config files to [Go programs] Error out when unrecognized keys appear in config files

#5 Updated by Tom Morris 8 months ago

  • Assigned To deleted (Tom Morris)
  • Target version changed from Arvados Future Sprints to To Be Groomed

#6 Updated by Tom Morris 5 months ago

  • Subject changed from [Go programs] Error out when unrecognized keys appear in config files to [Go programs]Warn or error when unrecognized keys appear in config files
  • Description updated (diff)
  • Target version changed from To Be Groomed to Arvados Future Sprints
  • Story points set to 1.0

#7 Updated by Tom Clegg 4 months ago

  • Related to Story #15003: [config] Go package & tool for preprocessing cluster config file added

#8 Updated by Tom Clegg 4 months ago

obsoleted/replaced by #15003

#9 Updated by Tom Clegg 4 months ago

  • Status changed from New to Feedback

#10 Updated by Tom Clegg 4 months ago

  • Status changed from Feedback to Closed

#11 Updated by Tom Morris 3 months ago

  • Target version deleted (Arvados Future Sprints)

Also available in: Atom PDF