Expand Supervisor to support loading additional scripts before user scripts

In supervised nodes, the Supervisor's NodeConfig$scripts vector adds scripts to
the end of the user-provided scripts (options.scripts_to_load), so they load
_after_ any user-provided ones. This can cause confusing redef pitfalls when
users expect their customizations to run last, as they normally do.

This adds two members in Supervisor::NodeConfig, `addl_base_scripts` and
`addl_user_scripts`, to store scripts to load before and after the user scripts,
respectively. The latter serves the same purpose as the old `scripts` member,
which is still there but deprecated (in scriptland only). It functions as
before, after any scripts added via `addl_user_scripts`.
This commit is contained in:
Christian Kreibich 2022-08-24 14:50:03 -07:00
parent 61c001a57e
commit c7860e3238
5 changed files with 107 additions and 12 deletions

View file

@ -198,9 +198,20 @@ public:
*/
std::optional<bool> bare_mode;
/**
* Additional script filename/paths that the node should load.
* Additional script filenames/paths that the node should load
* after the base scripts, and prior to any user-specified ones.
*/
std::vector<std::string> scripts;
std::vector<std::string> addl_base_scripts;
/**
* Additional script filename/paths that the node should load
* after any user-specified scripts.
*/
std::vector<std::string> addl_user_scripts;
/**
* The former name for addl_user_scripts, now deprecated.
*/
std::vector<std::string> scripts
[[deprecated("Remove in v6.1. Use NodeConfig::addl_user_scripts.")]];
/**
* Environment variables and values to define in the node.
*/