diff options
author | Devaev Maxim <[email protected]> | 2019-06-26 21:31:53 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2019-06-26 21:31:53 +0300 |
commit | 071fd62f41026565e6e012f492c5ee9b8bbb10bc (patch) | |
tree | 5eeeb0bfb318a84b061164948894afff3271c249 | |
parent | 8a40b1f06294caa21bc7d43ef32da71cc1a9bc6f (diff) |
override
-rw-r--r-- | PKGBUILD | 4 | ||||
-rw-r--r-- | configs/kvmd/main/v0-hdmi.yaml | 3 | ||||
-rw-r--r-- | configs/kvmd/main/v0-vga.yaml | 3 | ||||
-rw-r--r-- | configs/kvmd/main/v1-hdmi.yaml | 3 | ||||
-rw-r--r-- | configs/kvmd/main/v1-vga.yaml | 3 | ||||
-rw-r--r-- | configs/kvmd/override.yaml | 7 | ||||
-rw-r--r-- | kvmd/apps/__init__.py | 3 | ||||
-rw-r--r-- | testenv/main.yaml | 1 |
8 files changed, 25 insertions, 2 deletions
@@ -87,8 +87,8 @@ package_kvmd() { for _path in "$_cfg_default/kvmd"/*.yaml; do ln -sf "/usr/share/kvmd/configs.default/kvmd/`basename $_path`" "$pkgdir/etc/kvmd" done - rm "$pkgdir/etc/kvmd"/{auth.yaml,meta.yaml} - cp "$_cfg_default/kvmd"/{auth.yaml,meta.yaml} "$pkgdir/etc/kvmd" + rm "$pkgdir/etc/kvmd"/{override.yaml,logging.yaml,auth.yaml,meta.yaml} + cp "$_cfg_default/kvmd"/{override.yaml,logging.yaml,auth.yaml,meta.yaml} "$pkgdir/etc/kvmd" cp "$_cfg_default/kvmd/"*passwd "$pkgdir/etc/kvmd" chmod 600 "$pkgdir/etc/kvmd/"*passwd for _path in "$_cfg_default/nginx"/*.conf; do diff --git a/configs/kvmd/main/v0-hdmi.yaml b/configs/kvmd/main/v0-hdmi.yaml index a76cbb70..6f505168 100644 --- a/configs/kvmd/main/v0-hdmi.yaml +++ b/configs/kvmd/main/v0-hdmi.yaml @@ -1,6 +1,9 @@ # Don't touch this file otherwise your device may stop working. +# Use override.yaml to modify required settings. # You can find a working configuration in /usr/share/kvmd/configs.default/kvmd. +override: !include override.yaml + logging: !include logging.yaml kvmd: diff --git a/configs/kvmd/main/v0-vga.yaml b/configs/kvmd/main/v0-vga.yaml index 4b8a418f..ed31739a 100644 --- a/configs/kvmd/main/v0-vga.yaml +++ b/configs/kvmd/main/v0-vga.yaml @@ -1,6 +1,9 @@ # Don't touch this file otherwise your device may stop working. +# Use override.yaml to modify required settings. # You can find a working configuration in /usr/share/kvmd/configs.default/kvmd. +override: !include override.yaml + logging: !include logging.yaml kvmd: diff --git a/configs/kvmd/main/v1-hdmi.yaml b/configs/kvmd/main/v1-hdmi.yaml index f3403eca..5e78b971 100644 --- a/configs/kvmd/main/v1-hdmi.yaml +++ b/configs/kvmd/main/v1-hdmi.yaml @@ -1,6 +1,9 @@ # Don't touch this file otherwise your device may stop working. +# Use override.yaml to modify required settings. # You can find a working configuration in /usr/share/kvmd/configs.default/kvmd. +override: !include override.yaml + logging: !include logging.yaml kvmd: diff --git a/configs/kvmd/main/v1-vga.yaml b/configs/kvmd/main/v1-vga.yaml index 80e82bb9..3eb9be94 100644 --- a/configs/kvmd/main/v1-vga.yaml +++ b/configs/kvmd/main/v1-vga.yaml @@ -1,6 +1,9 @@ # Don't touch this file otherwise your device may stop working. +# Use override.yaml to modify required settings. # You can find a working configuration in /usr/share/kvmd/configs.default/kvmd. +override: !include override.yaml + logging: !include logging.yaml kvmd: diff --git a/configs/kvmd/override.yaml b/configs/kvmd/override.yaml new file mode 100644 index 00000000..c3190c07 --- /dev/null +++ b/configs/kvmd/override.yaml @@ -0,0 +1,7 @@ +# Use this file to override system settings and other configs like this: +# +# kvmd: +# server: +# heartbeat: 5.0 +# +# It will be applied AFTER other configs and "!include" directives and BEFORE validation. diff --git a/kvmd/apps/__init__.py b/kvmd/apps/__init__.py index 99648d10..589836a8 100644 --- a/kvmd/apps/__init__.py +++ b/kvmd/apps/__init__.py @@ -108,6 +108,7 @@ def _init_config(config_path: str, sections: List[str], override_options: List[s scheme = _get_config_scheme(sections) try: _merge_dicts(raw_config, build_raw_from_options(override_options)) + _merge_dicts(raw_config, (raw_config.get("override") or {})) config = make_config(raw_config, scheme) if "kvmd" in sections: @@ -143,6 +144,8 @@ def _merge_dicts(dest: Dict, src: Dict) -> None: def _get_config_scheme(sections: List[str]) -> Dict: scheme = { + "override": Option({}), + "logging": Option({}), "kvmd": { diff --git a/testenv/main.yaml b/testenv/main.yaml index d562ce45..eaa2917b 100644 --- a/testenv/main.yaml +++ b/testenv/main.yaml @@ -43,3 +43,4 @@ ipmi: unix: /run/kvmd/kvmd.sock logging: !include logging.yaml +override: !include override.yaml |