1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-18 01:41:35 +00:00

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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
47 changed files with 453 additions and 454 deletions

View file

@ -317,7 +317,7 @@ def run_module():
login_querystring = login_host
if login_port != 1433:
login_querystring = "%s:%s" % (login_host, login_port)
login_querystring = f"{login_host}:{login_port}"
if login_user is not None and login_password is None:
module.fail_json(
@ -330,7 +330,7 @@ def run_module():
except Exception as e:
if "Unknown database" in str(e):
errno, errstr = e.args
module.fail_json(msg="ERROR: %s %s" % (errno, errstr))
module.fail_json(msg=f"ERROR: {errno} {errstr}")
else:
module.fail_json(msg="unable to connect, check login_user and login_password are correct, or alternatively check your "
"@sysconfdir@/freetds.conf / ${HOME}/.freetds.conf")
@ -388,7 +388,7 @@ def run_module():
# Rollback transaction before failing the module in case of error
if transaction:
conn.rollback()
error_msg = '%s: %s' % (type(e).__name__, str(e))
error_msg = f'{type(e).__name__}: {e}'
module.fail_json(msg="query failed", query=query, error=error_msg, **result)
# Commit transaction before exiting the module in case of no error