From f27839673c88ed9ed00f23b45e70b4acb19daa58 Mon Sep 17 00:00:00 2001
From: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Date: Sun, 30 Nov 2025 20:27:13 +1300
Subject: [PATCH] fix couple of f-string mishaps (#11229)
* fix couple of f-string mishaps
* add changelog frag
* fix insanity
---
changelogs/fragments/11229-fstr-mishaps.yml | 4 ++++
plugins/modules/pam_limits.py | 2 +-
plugins/modules/spectrum_model_attrs.py | 2 +-
plugins/modules/xml.py | 1 -
4 files changed, 6 insertions(+), 3 deletions(-)
create mode 100644 changelogs/fragments/11229-fstr-mishaps.yml
diff --git a/changelogs/fragments/11229-fstr-mishaps.yml b/changelogs/fragments/11229-fstr-mishaps.yml
new file mode 100644
index 0000000000..8d8589f605
--- /dev/null
+++ b/changelogs/fragments/11229-fstr-mishaps.yml
@@ -0,0 +1,4 @@
+bugfixes:
+ - pam_limits - remove ``%`` templating no longer used in f-string (https://github.com/ansible-collections/community.general/pull/11229).
+minor_changes:
+ - spectrum_model_attrs - convert ``%`` templating to f-string (https://github.com/ansible-collections/community.general/pull/11229).
diff --git a/plugins/modules/pam_limits.py b/plugins/modules/pam_limits.py
index 85a0784424..5bc0239c25 100644
--- a/plugins/modules/pam_limits.py
+++ b/plugins/modules/pam_limits.py
@@ -158,7 +158,7 @@ def _assert_is_valid_value(module, item, value, prefix=""):
module.fail_json(
msg=f"{prefix} Value of {value!r} for item {item!r} is invalid. Value must either be 'unlimited', 'infinity' or -1, all of "
"which indicate no limit, or a limit of 0 or larger. Refer to the limits.conf(5) manual pages for "
- "more details." % (prefix, value, item)
+ "more details."
)
diff --git a/plugins/modules/spectrum_model_attrs.py b/plugins/modules/spectrum_model_attrs.py
index b3b0a66cd4..88799eecbd 100644
--- a/plugins/modules/spectrum_model_attrs.py
+++ b/plugins/modules/spectrum_model_attrs.py
@@ -348,7 +348,7 @@ class spectrum_model_attrs:
rqstd_attrs = ""
for ra in ret_attrs:
_id = self.attr_id(ra) or ra
- rqstd_attrs += '' % (self.attr_id(ra) or ra)
+ rqstd_attrs = f'{rqstd_attrs}'
# Build the complete XML search query for HTTP POST.
xml = f"""
diff --git a/plugins/modules/xml.py b/plugins/modules/xml.py
index d94a02032b..b73d70f1fb 100644
--- a/plugins/modules/xml.py
+++ b/plugins/modules/xml.py
@@ -583,7 +583,6 @@ def split_xpath_last(xpath):
def nsnameToClark(name, namespaces):
if ":" in name:
(nsname, rawname) = name.split(":")
- # return "{{%s}}%s" % (namespaces[nsname], rawname)
return f"{{{namespaces[nsname]}}}{rawname}"
# no namespace name here