diff options
author | Devaev Maxim <[email protected]> | 2020-10-03 03:34:55 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-10-03 05:02:14 +0300 |
commit | cccf44655aadc80d2d535033951e7af9ac65a271 (patch) | |
tree | 1ea9607e91e0189a0d73e87bed39b14c29213585 /kvmd/apps | |
parent | 872145590a3227b799ae7f5e7731dfc15967d63c (diff) |
common env variables
Diffstat (limited to 'kvmd/apps')
-rw-r--r-- | kvmd/apps/__init__.py | 2 | ||||
-rw-r--r-- | kvmd/apps/kvmd/info/hw.py | 9 |
2 files changed, 3 insertions, 8 deletions
diff --git a/kvmd/apps/__init__.py b/kvmd/apps/__init__.py index f301e7d5..20d2d4da 100644 --- a/kvmd/apps/__init__.py +++ b/kvmd/apps/__init__.py @@ -302,8 +302,6 @@ def _get_config_scheme() -> Dict: "extras": Option("/usr/share/kvmd/extras", type=valid_abs_dir), "hw": { "vcgencmd_cmd": Option(["/opt/vc/bin/vcgencmd"], type=valid_command), - "procfs_prefix": Option("", type=tools.str_strip), - "sysfs_prefix": Option("", type=tools.str_strip), "state_poll": Option(10.0, type=valid_float_f01), }, }, diff --git a/kvmd/apps/kvmd/info/hw.py b/kvmd/apps/kvmd/info/hw.py index 8df8aee5..e34ace5b 100644 --- a/kvmd/apps/kvmd/info/hw.py +++ b/kvmd/apps/kvmd/info/hw.py @@ -33,6 +33,7 @@ import aiofiles from ....logging import get_logger +from .... import env from .... import aioproc from .base import BaseInfoSubmanager @@ -47,14 +48,10 @@ class HwInfoSubmanager(BaseInfoSubmanager): def __init__( self, vcgencmd_cmd: List[str], - procfs_prefix: str, - sysfs_prefix: str, state_poll: float, ) -> None: self.__vcgencmd_cmd = vcgencmd_cmd - self.__sysfs_prefix = sysfs_prefix - self.__procfs_prefix = procfs_prefix self.__state_poll = state_poll async def get_state(self) -> Dict: @@ -90,7 +87,7 @@ class HwInfoSubmanager(BaseInfoSubmanager): # ===== async def __get_dt_model(self) -> Optional[str]: - model_path = f"{self.__procfs_prefix}/proc/device-tree/model" + model_path = f"{env.PROCFS_PREFIX}/proc/device-tree/model" try: async with aiofiles.open(model_path) as model_file: return (await model_file.read()).strip(" \t\r\n\0") @@ -99,7 +96,7 @@ class HwInfoSubmanager(BaseInfoSubmanager): return None async def __get_cpu_temp(self) -> Optional[float]: - temp_path = f"{self.__sysfs_prefix}/sys/class/thermal/thermal_zone0/temp" + temp_path = f"{env.SYSFS_PREFIX}/sys/class/thermal/thermal_zone0/temp" try: async with aiofiles.open(temp_path) as temp_file: return int((await temp_file.read()).strip()) / 1000 |