diff options
author | Robert Göhler <github@ghlr.de> | 2024-12-12 15:40:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-12 15:40:49 +0100 |
commit | 424e87276d6d770183e1cd38d68a23c18f87adc7 (patch) | |
tree | 5876696c9b23ea06b854db79512c69ff9a4730ca | |
parent | 8128e0cd57dcbcadf3963d30e9bbefc8ae507e5a (diff) | |
parent | d69a7c651c937d195c1d091551a42f701b3b97c2 (diff) | |
download | vyos-documentation-424e87276d6d770183e1cd38d68a23c18f87adc7.tar.gz vyos-documentation-424e87276d6d770183e1cd38d68a23c18f87adc7.zip |
Merge pull request #1575 from jestabro/config-script-guidelines
Fix typos and add constraints on conf-mode scripts under configd
-rw-r--r-- | docs/contributing/development.rst | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/docs/contributing/development.rst b/docs/contributing/development.rst index e39af3a5..c5df8b12 100644 --- a/docs/contributing/development.rst +++ b/docs/contributing/development.rst @@ -290,7 +290,7 @@ device if you happen to be a crazy scientist. from vyos.config import Config from vyos import ConfigError - def get_config(): + def get_config(config=None): if config: conf = config else: @@ -306,7 +306,6 @@ device if you happen to be a crazy scientist. # Verify that configuration is valid if invalid: raise ConfigError("Descriptive message") - return True def generate(config): # Generate daemon configs @@ -385,6 +384,24 @@ For easy orientation we suggest you take a look on the ``ntp.py`` or ``interfaces-bonding.py`` (for tag nodes) implementation. Both files can be found in the vyos-1x_ repository. +Other considerations: vyos-configd +---------------------------------- + +All scripts now run under the config daemon and must conform to the +following: + +1. The signature and initial four lines of ``get_config(...)`` `must` be as + above. + +2. Each of ``get_config``, ``verify``, ``apply``, ``generate`` `must` + appear, with signatures as above, even if they are a no-op. + +3. Instantiations of ``Config`` other than that in ``get_config`` `must not` + appear. + +4. The legacy function ``my_set`` `must not` appear: modifications of the + active config `should not` appear in new code (if absolutely necessary, + alternative mechanisms may be used). XML (used for CLI definitions) ============================== |