diff options
author | Devaev Maxim <[email protected]> | 2019-06-28 18:59:36 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2019-06-28 18:59:36 +0300 |
commit | ef3c62a7af520673154233e2d3c89492ffec3195 (patch) | |
tree | 2b78c5918143eff8ef2c89484ac99fc6b7588438 /kvmd/apps/ipmi | |
parent | ff270591b032cc1f8e342f20a04b84e5dbb31191 (diff) |
f-strings
Diffstat (limited to 'kvmd/apps/ipmi')
-rw-r--r-- | kvmd/apps/ipmi/auth.py | 6 | ||||
-rw-r--r-- | kvmd/apps/ipmi/server.py | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/kvmd/apps/ipmi/auth.py b/kvmd/apps/ipmi/auth.py index d4c922d7..6b33216a 100644 --- a/kvmd/apps/ipmi/auth.py +++ b/kvmd/apps/ipmi/auth.py @@ -61,12 +61,12 @@ class IpmiAuthManager: continue if " -> " not in line: - raise IpmiPasswdError("Missing ' -> ' operator at line #%d" % (number)) + raise IpmiPasswdError(f"Missing ' -> ' operator at line #{number}") (left, right) = map(str.lstrip, line.split(" -> ", 1)) for (name, pair) in [("left", left), ("right", right)]: if ":" not in pair: - raise IpmiPasswdError("Missing ':' operator in %s credentials at line #%d" % (name, number)) + raise IpmiPasswdError(f"Missing ':' operator in {name} credentials at line #{number}") (ipmi_user, ipmi_passwd) = left.split(":") ipmi_user = ipmi_user.strip() @@ -75,7 +75,7 @@ class IpmiAuthManager: kvmd_user = kvmd_user.strip() if ipmi_user in credentials: - raise IpmiPasswdError("Found duplicating user %r (left) at line #%d" % (ipmi_user, number)) + raise IpmiPasswdError(f"Found duplicating user {ipmi_user!r} (left) at line #{number}") credentials[ipmi_user] = IpmiUserCredentials( ipmi_user=ipmi_user, diff --git a/kvmd/apps/ipmi/server.py b/kvmd/apps/ipmi/server.py index 3bc2ed94..0201214f 100644 --- a/kvmd/apps/ipmi/server.py +++ b/kvmd/apps/ipmi/server.py @@ -155,7 +155,7 @@ class IpmiServer(BaseIpmiServer): # pylint: disable=too-many-instance-attribute logger = get_logger(0) assert handle.startswith("/") - url = "http://%s:%d%s" % (self.__kvmd_host, self.__kvmd_port, handle) + url = f"http://{self.__kvmd_host}:{self.__kvmd_port}{handle}" credentials = self.__auth_manager.get_credentials(ipmi_session.username.decode()) logger.info("Performing %r request to %r from user %r (IPMI) as %r (KVMD)", @@ -169,7 +169,7 @@ class IpmiServer(BaseIpmiServer): # pylint: disable=too-many-instance-attribute headers={ "X-KVMD-User": credentials.kvmd_user, "X-KVMD-Passwd": credentials.kvmd_passwd, - "User-Agent": "KVMD-IPMI/%s" % (__version__), + "User-Agent": f"KVMD-IPMI/{__version__}", }, timeout=self.__kvmd_timeout, ) as response: |