modules [lm]*: use f-strings (#10971)

* modules [lm]*: use f-strings

* add changelog frag
This commit is contained in:
Alexei Znamensky
2025-10-26 19:57:24 +13:00
committed by GitHub
parent 4a6a449fbd
commit b527e80307
47 changed files with 453 additions and 454 deletions

View File

@@ -202,7 +202,7 @@ def main():
result = mod.connection.search_ext_s(
base=mod.dn,
scope=ldap.SCOPE_BASE,
filterstr="(%s=*)" % mod.attr,
filterstr=f"({mod.attr}=*)",
attrlist=[mod.attr])
if len(result) != 1:
module.fail_json(msg="The entry does not exist or does not contain the specified attribute.")
@@ -216,14 +216,14 @@ def main():
break
except ldap.NO_SUCH_ATTRIBUTE:
if tries == max_tries:
module.fail_json(msg="The increment could not be applied after " + str(max_tries) + " tries.")
module.fail_json(msg=f"The increment could not be applied after {max_tries} tries.")
return
else:
result = mod.connection.search_ext_s(
base=mod.dn,
scope=ldap.SCOPE_BASE,
filterstr="(%s=*)" % mod.attr,
filterstr=f"({mod.attr}=*)",
attrlist=[mod.attr])
if len(result) == 1:
ret = str(int(result[0][1][mod.attr][0]) + mod.increment)