summaryrefslogtreecommitdiff
path: root/kvmd/apps/vnc
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-05-25 01:39:12 +0300
committerDevaev Maxim <[email protected]>2020-05-25 01:39:18 +0300
commit499cbb0cc57346708525dd1d0059e65a74598980 (patch)
tree1985fdcfdafcddc2d34bbce0c16fe3cc5ba4617d /kvmd/apps/vnc
parenteeece34312dc39f001c0718d07f12d90a279f736 (diff)
improved some logging
Diffstat (limited to 'kvmd/apps/vnc')
-rw-r--r--kvmd/apps/vnc/vncauth.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/kvmd/apps/vnc/vncauth.py b/kvmd/apps/vnc/vncauth.py
index b27d74d5..0689b9ca 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, msg: str) -> None:
- super().__init__(f"Incorrect VNCAuth passwd file: {msg}")
+ def __init__(self, path: str, number: int, msg: str) -> None:
+ super().__init__(f"Syntax error at {path}:{number}: {msg}")
# =====
@@ -73,19 +73,19 @@ class VncAuthManager:
continue
if " -> " not in line:
- raise VncAuthError(f"Missing ' -> ' operator at line #{number}")
+ raise VncAuthError(self.__path, number, "Missing ' -> ' operator")
(vnc_passwd, kvmd_userpass) = map(str.lstrip, line.split(" -> ", 1))
if ":" not in kvmd_userpass:
- raise VncAuthError(f"Missing ':' operator in KVMD credentials (right part) at line #{number}")
+ raise VncAuthError(self.__path, number, "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(f"Empty KVMD user (right part) at line #{number}")
+ raise VncAuthError(self.__path, number, "Empty KVMD user (right part)")
if vnc_passwd in credentials:
- raise VncAuthError(f"Found duplicating VNC password (left part) at line #{number}")
+ raise VncAuthError(self.__path, number, "Duplicating VNC password (left part)")
credentials[vnc_passwd] = VncAuthKvmdCredentials(kvmd_user, kvmd_passwd)
return credentials