Skip to content

manager: datamodel: better representation of paths and better error messages

Vaclav Sraier requested to merge manager-better-paths-in-model into manager

The way we process file paths in our datamodel is kind of messy. In short, all paths are resolved relative to $cwd and at startup, rundir is set as the $cwd. That means, there is an chicken-egg problem. To parse the config, we need to know the rundir field in the config. So if we check that the file paths exist during config validation, everything could fail. Moreover, the rundir can be a relative path, therefore the validation result depends on the initial $cwd.

Proposed solution

  1. limit rundir to be only an absolute path #784
  2. eliminate dependence on $cwd (implicit global variable) and pass rundir around in some context object

Both of these fixes at once would lead to the ability to deterministically load config files from anywhere without any dependence on $cwd. For example, we could then load the config file from within kresctl to determine the location of the management socket.

Current state of the MR

  1. done
  2. no clue how to do it nicely

These changes might be a dead end and they might not be worth it. 🤷

Merge request reports