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:
parent
4a6a449fbd
commit
b527e80307
47 changed files with 453 additions and 454 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue