diff options
author | Devaev Maxim <[email protected]> | 2020-05-25 01:49:39 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-05-25 01:49:39 +0300 |
commit | d5dca5a8b4eadd988505a6d84e2807cbea6c6d11 (patch) | |
tree | 6d8186cd8ec58057cfff020814de4c0eb1ed6e0f /kvmd/apps/vnc/vncauth.py | |
parent | 499cbb0cc57346708525dd1d0059e65a74598980 (diff) |
refactoring
Diffstat (limited to 'kvmd/apps/vnc/vncauth.py')
-rw-r--r-- | kvmd/apps/vnc/vncauth.py | 14 |
1 files changed, 7 insertions, 7 deletions
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 |