summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kvmd/apps/ipmi/auth.py16
-rw-r--r--kvmd/apps/vnc/vncauth.py14
-rw-r--r--kvmd/keyboard/keysym.py4
3 files changed, 17 insertions, 17 deletions
diff --git a/kvmd/apps/ipmi/auth.py b/kvmd/apps/ipmi/auth.py
index 7d17edc3..b9e4a644 100644
--- a/kvmd/apps/ipmi/auth.py
+++ b/kvmd/apps/ipmi/auth.py
@@ -28,8 +28,8 @@ from typing import Dict
# =====
class IpmiPasswdError(Exception):
- def __init__(self, path: str, number: int, msg: str) -> None:
- super().__init__(f"Syntax error at {path}:{number}: {msg}")
+ def __init__(self, path: str, lineno: int, msg: str) -> None:
+ super().__init__(f"Syntax error at {path}:{lineno}: {msg}")
@dataclasses.dataclass(frozen=True)
@@ -57,30 +57,30 @@ class IpmiAuthManager:
def __parse_passwd_file(self, lines: List[str]) -> Dict[str, IpmiUserCredentials]:
credentials: Dict[str, IpmiUserCredentials] = {}
- for (number, line) in enumerate(lines):
+ for (lineno, line) in enumerate(lines):
if len(line.strip()) == 0 or line.lstrip().startswith("#"):
continue
if " -> " not in line:
- raise IpmiPasswdError(self.__path, number, "Missing ' -> ' operator")
+ raise IpmiPasswdError(self.__path, lineno, "Missing ' -> ' operator")
(left, right) = map(str.lstrip, line.split(" -> ", 1))
for (name, pair) in [("left", left), ("right", right)]:
if ":" not in pair:
- raise IpmiPasswdError(self.__path, number, f"Missing ':' operator in {name} credentials")
+ raise IpmiPasswdError(self.__path, lineno, f"Missing ':' operator in {name} credentials")
(ipmi_user, ipmi_passwd) = left.split(":")
ipmi_user = ipmi_user.strip()
if len(ipmi_user) == 0:
- raise IpmiPasswdError(self.__path, number, "Empty IPMI user (left)")
+ raise IpmiPasswdError(self.__path, lineno, "Empty IPMI user (left)")
(kvmd_user, kvmd_passwd) = right.split(":")
kvmd_user = kvmd_user.strip()
if len(kvmd_user) == 0:
- raise IpmiPasswdError(self.__path, number, "Empty KVMD user (left)")
+ raise IpmiPasswdError(self.__path, lineno, "Empty KVMD user (left)")
if ipmi_user in credentials:
- raise IpmiPasswdError(self.__path, number, f"Found duplicating user {ipmi_user!r} (left)")
+ raise IpmiPasswdError(self.__path, lineno, f"Found duplicating user {ipmi_user!r} (left)")
credentials[ipmi_user] = IpmiUserCredentials(
ipmi_user=ipmi_user,
diff --git a/kvmd/apps/vnc/vncauth.py b/kvmd/apps/vnc/vncauth.py
index 0689b9ca..06420ee0 100644
--- a/kvmd/apps/vnc/vncauth.py
+++ b/kvmd/apps/vnc/vncauth.py
@@ -32,8 +32,8 @@ from ...logging import get_logger
# =====
class VncAuthError(Exception):
- def __init__(self, path: str, number: int, msg: str) -> None:
- super().__init__(f"Syntax error at {path}:{number}: {msg}")
+ def __init__(self, path: str, lineno: int, msg: str) -> None:
+ super().__init__(f"Syntax error at {path}:{lineno}: {msg}")
# =====
@@ -68,24 +68,24 @@ class VncAuthManager:
lines = (await vc_file.read()).split("\n")
credentials: Dict[str, VncAuthKvmdCredentials] = {}
- for (number, line) in enumerate(lines):
+ for (lineno, line) in enumerate(lines):
if len(line.strip()) == 0 or line.lstrip().startswith("#"):
continue
if " -> " not in line:
- raise VncAuthError(self.__path, number, "Missing ' -> ' operator")
+ raise VncAuthError(self.__path, lineno, "Missing ' -> ' operator")
(vnc_passwd, kvmd_userpass) = map(str.lstrip, line.split(" -> ", 1))
if ":" not in kvmd_userpass:
- raise VncAuthError(self.__path, number, "Missing ':' operator in KVMD credentials (right part)")
+ raise VncAuthError(self.__path, lineno, "Missing ':' operator in KVMD credentials (right part)")
(kvmd_user, kvmd_passwd) = kvmd_userpass.split(":")
kvmd_user = kvmd_user.strip()
if len(kvmd_user) == 0:
- raise VncAuthError(self.__path, number, "Empty KVMD user (right part)")
+ raise VncAuthError(self.__path, lineno, "Empty KVMD user (right part)")
if vnc_passwd in credentials:
- raise VncAuthError(self.__path, number, "Duplicating VNC password (left part)")
+ raise VncAuthError(self.__path, lineno, "Duplicating VNC password (left part)")
credentials[vnc_passwd] = VncAuthKvmdCredentials(kvmd_user, kvmd_passwd)
return credentials
diff --git a/kvmd/keyboard/keysym.py b/kvmd/keyboard/keysym.py
index 3749f7da..89919e5c 100644
--- a/kvmd/keyboard/keysym.py
+++ b/kvmd/keyboard/keysym.py
@@ -107,7 +107,7 @@ def _read_keyboard_layout(path: str) -> Dict[int, At1Key]: # Keysym to evdev (a
lines = list(map(str.strip, layout_file.read().split("\n")))
layout: Dict[int, At1Key] = {}
- for (number, line) in enumerate(lines):
+ for (lineno, line) in enumerate(lines):
if len(line) == 0 or line.startswith(("#", "map ", "include ")):
continue
@@ -122,5 +122,5 @@ def _read_keyboard_layout(path: str) -> Dict[int, At1Key]: # Keysym to evdev (a
ctrl=("ctrl" in parts[2:]),
)
except ValueError as err:
- logger.error("Syntax error at %s:%d: %s", path, number, err)
+ logger.error("Syntax error at %s:%d: %s", path, lineno, err)
return layout