summaryrefslogtreecommitdiff
path: root/kvmd/apps
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-10-31 05:19:35 +0300
committerDevaev Maxim <[email protected]>2020-10-31 05:19:35 +0300
commit386461c9746665ef3440fe2c29ec60584d29cbbf (patch)
treebeeb97afc642eec4f31ca680ce9e5e1776f7fbde /kvmd/apps
parenta286cd5ec2166f79c26cda659983858daabccfbd (diff)
advanced cmd options for streamer
Diffstat (limited to 'kvmd/apps')
-rw-r--r--kvmd/apps/__init__.py5
-rw-r--r--kvmd/apps/kvmd/streamer.py8
2 files changed, 11 insertions, 2 deletions
diff --git a/kvmd/apps/__init__.py b/kvmd/apps/__init__.py
index 820278ce..b8a4c160 100644
--- a/kvmd/apps/__init__.py
+++ b/kvmd/apps/__init__.py
@@ -73,6 +73,7 @@ from ..validators.os import valid_abs_path
from ..validators.os import valid_abs_file
from ..validators.os import valid_abs_dir
from ..validators.os import valid_unix_mode
+from ..validators.os import valid_options
from ..validators.os import valid_command
from ..validators.net import valid_ip_or_host
@@ -363,7 +364,9 @@ def _get_config_scheme() -> Dict:
"process_name_prefix": Option("kvmd/streamer"),
- "cmd": Option(["/bin/true"], type=valid_command),
+ "cmd": Option(["/bin/true"], type=valid_command),
+ "cmd_remove": Option([], type=valid_options),
+ "cmd_append": Option([], type=valid_options),
},
"snapshot": {
diff --git a/kvmd/apps/kvmd/streamer.py b/kvmd/apps/kvmd/streamer.py
index 48336c98..047e4c97 100644
--- a/kvmd/apps/kvmd/streamer.py
+++ b/kvmd/apps/kvmd/streamer.py
@@ -132,6 +132,8 @@ class Streamer: # pylint: disable=too-many-instance-attributes
process_name_prefix: str,
cmd: List[str],
+ cmd_remove: List[str],
+ cmd_append: List[str],
**params_kwargs: Any,
) -> None:
@@ -148,7 +150,11 @@ class Streamer: # pylint: disable=too-many-instance-attributes
self.__process_name_prefix = process_name_prefix
- self.__cmd = cmd
+ self.__cmd = [
+ cmd[0], # Executable
+ *filter((lambda item: item not in cmd_remove), cmd[1:]),
+ *cmd_append,
+ ]
self.__params = _StreamerParams(**params_kwargs)