1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-05-03 08:52:55 +00:00

modules s[f-z]*: use f-strings (#10977)

* modules s[f-z]*: use f-strings

* add changelog frag
This commit is contained in:
Alexei Znamensky 2025-10-26 22:35:30 +13:00 committed by GitHub
parent 73452acf84
commit af246f8de3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 274 additions and 273 deletions

View file

@ -131,22 +131,22 @@ class Swupd(object):
cmd = [self.swupd_cmd] + command
if self.format:
cmd.append("--format=%s" % self.format)
cmd.append(f"--format={self.format}")
if self.manifest:
cmd.append("--manifest=%s" % self.manifest)
cmd.append(f"--manifest={self.manifest}")
if self.url:
cmd.append("--url=%s" % self.url)
cmd.append(f"--url={self.url}")
else:
if self.contenturl and command != "check-update":
cmd.append("--contenturl=%s" % self.contenturl)
cmd.append(f"--contenturl={self.contenturl}")
if self.versionurl:
cmd.append("--versionurl=%s" % self.versionurl)
cmd.append(f"--versionurl={self.versionurl}")
return cmd
def _is_bundle_installed(self, bundle):
try:
os.stat("/usr/share/clear/bundles/%s" % bundle)
os.stat(f"/usr/share/clear/bundles/{bundle}")
except OSError:
return False
@ -184,7 +184,7 @@ class Swupd(object):
self.module.exit_json(changed=not self._is_bundle_installed(bundle))
if self._is_bundle_installed(bundle):
self.msg = "Bundle %s is already installed" % bundle
self.msg = f"Bundle {bundle} is already installed"
return
cmd = self._get_cmd(["bundle-add", bundle])
@ -192,11 +192,11 @@ class Swupd(object):
if self.rc == 0:
self.changed = True
self.msg = "Bundle %s installed" % bundle
self.msg = f"Bundle {bundle} installed"
return
self.failed = True
self.msg = "Failed to install bundle %s" % bundle
self.msg = f"Failed to install bundle {bundle}"
def remove_bundle(self, bundle):
"""Removes a bundle with `swupd bundle-remove bundle`"""
@ -212,11 +212,11 @@ class Swupd(object):
if self.rc == 0:
self.changed = True
self.msg = "Bundle %s removed" % bundle
self.msg = f"Bundle {bundle} removed"
return
self.failed = True
self.msg = "Failed to remove bundle %s" % bundle
self.msg = f"Failed to remove bundle {bundle}"
def update_os(self):
"""Updates the os with `swupd update`"""