mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Replace .format() calls with f-strings across multiple plugins (#11879)
* Replace .format() calls with f-strings across multiple plugins Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> * Add changelog fragment for PR 11879 Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -220,9 +220,9 @@ def main():
|
||||
name = module.params["name"]
|
||||
state = module.params["state"]
|
||||
|
||||
module.params["proto"] = "https" if use_ssl else "http"
|
||||
proto = "https" if use_ssl else "http"
|
||||
if not port:
|
||||
module.params["port"] = "443" if use_ssl else "80"
|
||||
port = "443" if use_ssl else "80"
|
||||
|
||||
result = dict(
|
||||
changed=False,
|
||||
@@ -232,17 +232,13 @@ def main():
|
||||
|
||||
ssl_context = None if validate_certs or not use_ssl else ssl._create_unverified_context()
|
||||
|
||||
url = "{proto}://{host}:{port}/cobbler_api".format(**module.params)
|
||||
url = f"{proto}://{module.params['host']}:{port}/cobbler_api"
|
||||
conn = xmlrpc_client.ServerProxy(url, context=ssl_context)
|
||||
|
||||
try:
|
||||
token = conn.login(username, password)
|
||||
except xmlrpc_client.Fault as e:
|
||||
module.fail_json(
|
||||
msg="Failed to log in to Cobbler '{url}' as '{username}'. {error}".format(
|
||||
url=url, error=f"{e}", **module.params
|
||||
)
|
||||
)
|
||||
module.fail_json(msg=f"Failed to log in to Cobbler '{url}' as '{username}'. {e}")
|
||||
except Exception as e:
|
||||
module.fail_json(msg=f"Connection to '{url}' failed. {e}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user