Right now, the config backend calls config scripts directly. To facilitate that, they use a structure like:
if __name__ == '__main__': verify() generate() apply()
One of the reasons that that structure was to enable the future backend (VyConf) to run stages independently. It was thought, however, that calling those stages right now isn't worth the trouble because we cannot parallelize commits.
However, there's another use case for that: unified logging and profiling.
If we write a script runner capable of running stages, we can measure how long each stage of each script takes, It will also be easier to log exceptions and warnings to one place.
If there are no scripts that use custom initialization, we can introduce it simply by replacing script calls to wrapper calls:
vyos-config-script-runner <path to script>