summaryrefslogtreecommitdiff
path: root/kvmd/apps/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'kvmd/apps/__init__.py')
-rw-r--r--kvmd/apps/__init__.py26
1 files changed, 18 insertions, 8 deletions
diff --git a/kvmd/apps/__init__.py b/kvmd/apps/__init__.py
index d930ed8f..5b07aae5 100644
--- a/kvmd/apps/__init__.py
+++ b/kvmd/apps/__init__.py
@@ -79,7 +79,6 @@ from ..validators.os import valid_options
from ..validators.os import valid_command
from ..validators.net import valid_ip_or_host
-from ..validators.net import valid_ip
from ..validators.net import valid_net
from ..validators.net import valid_port
from ..validators.net import valid_ports_list
@@ -183,7 +182,7 @@ def _init_config(config_path: str, override_options: List[str], **load_flags: bo
raise SystemExit(f"ConfigError: {err}")
-def _patch_raw(raw_config: Dict) -> None:
+def _patch_raw(raw_config: Dict) -> None: # pylint: disable=too-many-branches
if isinstance(raw_config.get("otg"), dict):
for (old, new) in [
("msd", "msd"),
@@ -195,6 +194,23 @@ def _patch_raw(raw_config: Dict) -> None:
raw_config["otg"]["devices"] = {}
raw_config["otg"]["devices"][new] = raw_config["otg"].pop(old)
+ if isinstance(raw_config.get("kvmd"), dict) and isinstance(raw_config["kvmd"].get("wol"), dict):
+ if not isinstance(raw_config["kvmd"].get("gpio"), dict):
+ raw_config["kvmd"]["gpio"] = {}
+ for section in ["drivers", "scheme"]:
+ if not isinstance(raw_config["kvmd"]["gpio"].get(section), dict):
+ raw_config["kvmd"]["gpio"][section] = {}
+ raw_config["kvmd"]["gpio"]["drivers"]["__wol__"] = {
+ "type": "wol",
+ **raw_config["kvmd"].pop("wol"),
+ }
+ raw_config["kvmd"]["gpio"]["scheme"]["__wol__"] = {
+ "driver": "__wol__",
+ "pin": 0,
+ "mode": "output",
+ "switch": False,
+ }
+
if isinstance(raw_config.get("kvmd"), dict) and isinstance(raw_config["kvmd"].get("streamer"), dict):
streamer_config = raw_config["kvmd"]["streamer"]
@@ -359,12 +375,6 @@ def _get_config_scheme() -> Dict:
},
},
- "wol": {
- "ip": Option("255.255.255.255", type=functools.partial(valid_ip, v6=False)),
- "port": Option(9, type=valid_port),
- "mac": Option("", type=_make_ifarg(valid_mac, "")),
- },
-
"hid": {
"type": Option("", type=valid_stripped_string_not_empty),