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:
Alexei Znamensky
2026-04-19 22:37:32 +12:00
committed by GitHub
parent d0d213a41d
commit 77509be2aa
15 changed files with 88 additions and 114 deletions

View File

@@ -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}")