bottlerocket-os / bottlerocket-settings-sdk

A Rust library for extending Bottlerocket's settings API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Expand `GenerateResult` type to include more context

cbgbt opened this issue · comments

When we generate settings in a settings extension, we provide two pieces of information:

  • Any data that is already specified for the setting
  • Any data that exists for other settings that this setting depends on for generation

The GenerateResult type returned from SettingsModel::generate provides back two pieces of information:

  • Whether or not generation is complete
  • The partial or complete data that has been set so far

Using this interface, the settings API repeatedly invokes settings generators until they are all complete. This works in most cases, but it does not provide a clear picture of what is wrong if something fails. It could also be more efficient.

DoD:
Change the settings generation interface such that:

  • The generator knows whether or not its dependencies have completed their own generation
  • If the generation is not complete, it can return "hints" pointing to specific settings that need to be generated first (this can direct the settings system to try and run these dependencies first, though it does not guarantee it).