modules [no]*: use f-strings (#10973)

* modules [no]*: use f-strings

* add changelog frag
This commit is contained in:
Alexei Znamensky
2025-10-26 19:48:10 +13:00
committed by GitHub
parent 50846b7560
commit 749c06cd01
44 changed files with 399 additions and 412 deletions

View File

@@ -403,7 +403,7 @@ def handle_enabled(module, result, service_path):
if not module.check_mode:
(rc, out, err) = run_sys_ctl(module, [action, service_path])
if rc != 0:
module.fail_json(msg="Unable to %s service %s: %s" % (action, service_path, out + err))
module.fail_json(msg=f"Unable to {action} service {service_path}: {out + err}")
result['preset'] = not preset
result['enabled'] = not enabled
@@ -420,7 +420,7 @@ def handle_enabled(module, result, service_path):
if not module.check_mode:
(rc, out, err) = run_sys_ctl(module, [action, service_path])
if rc != 0:
module.fail_json(msg="Unable to %s service %s: %s" % (action, service_path, out + err))
module.fail_json(msg=f"Unable to {action} service {service_path}: {out + err}")
result['enabled'] = not enabled
result['preset'] = not preset
@@ -496,7 +496,7 @@ def handle_state(module, result, service_path):
if not module.check_mode:
(rc, out, err) = run_sys_ctl(module, [action, service_path])
if rc != 0:
module.fail_json(msg="Unable to %s service %s: %s" % (action, service_path, err))
module.fail_json(msg=f"Unable to {action} service {service_path}: {err}")
# ===========================================
# Main control flow