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

@ -45,8 +45,15 @@ export {
## Whether to start the node in bare mode. When left out, the node
## inherits the bare-mode status the supervisor itself runs with.
bare_mode: bool &optional;
## Additional script filenames/paths that the node should load.
scripts: vector of string &default = vector();
## Additional script filenames/paths that the node should load
## after the base scripts, and prior to any user-specified ones.
addl_base_scripts: vector of string &default = vector();
## Additional script filenames/paths that the node should load
## after any user-specified scripts.
addl_user_scripts: vector of string &default = vector();
## The former name of addl_user_scripts.
scripts: vector of string &default = vector()
&deprecated="Remove in 6.1. Use the addl_user_scripts field instead.";
## Environment variables to define in the supervised node.
env: table[string] of string &default=table();
## A cpu/core number to which the node will try to pin itself.