aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sos/report/plugins/__init__.py331
-rw-r--r--sos/report/plugins/abrt.py4
-rw-r--r--sos/report/plugins/alternatives.py8
-rw-r--r--sos/report/plugins/apache.py12
-rw-r--r--sos/report/plugins/auditd.py4
-rw-r--r--sos/report/plugins/block.py2
-rw-r--r--sos/report/plugins/boot.py4
-rw-r--r--sos/report/plugins/buildah.py6
-rw-r--r--sos/report/plugins/candlepin.py2
-rw-r--r--sos/report/plugins/canonical_livepatch_onprem.py2
-rw-r--r--sos/report/plugins/ceph_common.py6
-rw-r--r--sos/report/plugins/collectd.py8
-rw-r--r--sos/report/plugins/composer.py6
-rw-r--r--sos/report/plugins/console.py2
-rw-r--r--sos/report/plugins/containers_common.py7
-rw-r--r--sos/report/plugins/corosync.py2
-rw-r--r--sos/report/plugins/crio.py12
-rw-r--r--sos/report/plugins/crypto.py4
-rw-r--r--sos/report/plugins/dellrac.py8
-rw-r--r--sos/report/plugins/dlm.py4
-rw-r--r--sos/report/plugins/dmraid.py2
-rw-r--r--sos/report/plugins/dnf.py2
-rw-r--r--sos/report/plugins/docker.py12
-rw-r--r--sos/report/plugins/ds.py4
-rw-r--r--sos/report/plugins/ebpf.py10
-rw-r--r--sos/report/plugins/elastic.py16
-rw-r--r--sos/report/plugins/fibrechannel.py6
-rw-r--r--sos/report/plugins/filesys.py4
-rw-r--r--sos/report/plugins/foreman.py12
-rw-r--r--sos/report/plugins/foreman_installer.py8
-rw-r--r--sos/report/plugins/gluster.py20
-rw-r--r--sos/report/plugins/grafana.py2
-rw-r--r--sos/report/plugins/grub2.py2
-rw-r--r--sos/report/plugins/hpssm.py12
-rw-r--r--sos/report/plugins/infiniband.py4
-rw-r--r--sos/report/plugins/ipa.py14
-rw-r--r--sos/report/plugins/ipmitool.py24
-rw-r--r--sos/report/plugins/iprconfig.py8
-rw-r--r--sos/report/plugins/juju.py2
-rw-r--r--sos/report/plugins/kdump.py4
-rw-r--r--sos/report/plugins/kernel.py4
-rw-r--r--sos/report/plugins/kubernetes.py2
-rw-r--r--sos/report/plugins/landscape.py2
-rw-r--r--sos/report/plugins/libraries.py2
-rw-r--r--sos/report/plugins/libvirt.py4
-rw-r--r--sos/report/plugins/logs.py2
-rw-r--r--sos/report/plugins/lstopo.py4
-rw-r--r--sos/report/plugins/lustre.py4
-rw-r--r--sos/report/plugins/lvm2.py12
-rw-r--r--sos/report/plugins/maas.py11
-rw-r--r--sos/report/plugins/md.py2
-rw-r--r--sos/report/plugins/megacli.py2
-rw-r--r--sos/report/plugins/microshift.py18
-rw-r--r--sos/report/plugins/mssql.py9
-rw-r--r--sos/report/plugins/mvcli.py2
-rw-r--r--sos/report/plugins/mysql.py6
-rw-r--r--sos/report/plugins/navicli.py28
-rw-r--r--sos/report/plugins/networking.py21
-rw-r--r--sos/report/plugins/networkmanager.py3
-rw-r--r--sos/report/plugins/ntp.py2
-rw-r--r--sos/report/plugins/nvidia.py6
-rw-r--r--sos/report/plugins/omnipath_client.py5
-rw-r--r--sos/report/plugins/openshift.py42
-rw-r--r--sos/report/plugins/openssl.py2
-rw-r--r--sos/report/plugins/openstack_aodh.py8
-rw-r--r--sos/report/plugins/openstack_barbican.py7
-rw-r--r--sos/report/plugins/openstack_ceilometer.py7
-rw-r--r--sos/report/plugins/openstack_cinder.py7
-rw-r--r--sos/report/plugins/openstack_database.py4
-rw-r--r--sos/report/plugins/openstack_designate.py6
-rw-r--r--sos/report/plugins/openstack_glance.py8
-rw-r--r--sos/report/plugins/openstack_heat.py7
-rw-r--r--sos/report/plugins/openstack_horizon.py2
-rw-r--r--sos/report/plugins/openstack_instack.py14
-rw-r--r--sos/report/plugins/openstack_ironic.py16
-rw-r--r--sos/report/plugins/openstack_keystone.py9
-rw-r--r--sos/report/plugins/openstack_manila.py15
-rw-r--r--sos/report/plugins/openstack_masakari.py7
-rw-r--r--sos/report/plugins/openstack_masakarimonitors.py2
-rw-r--r--sos/report/plugins/openstack_neutron.py7
-rw-r--r--sos/report/plugins/openstack_nova.py11
-rw-r--r--sos/report/plugins/openstack_octavia.py10
-rw-r--r--sos/report/plugins/openstack_placement.py7
-rw-r--r--sos/report/plugins/openstack_sahara.py7
-rw-r--r--sos/report/plugins/openstack_swift.py8
-rw-r--r--sos/report/plugins/openstack_trove.py7
-rw-r--r--sos/report/plugins/opensvc.py4
-rw-r--r--sos/report/plugins/openvswitch.py70
-rw-r--r--sos/report/plugins/origin.py22
-rw-r--r--sos/report/plugins/ovirt.py20
-rw-r--r--sos/report/plugins/ovirt_engine_backup.py11
-rw-r--r--sos/report/plugins/ovirt_node.py2
-rw-r--r--sos/report/plugins/ovn_central.py21
-rw-r--r--sos/report/plugins/pacemaker.py9
-rw-r--r--sos/report/plugins/pam.py2
-rw-r--r--sos/report/plugins/pcp.py6
-rw-r--r--sos/report/plugins/perccli.py8
-rw-r--r--sos/report/plugins/peripety.py4
-rw-r--r--sos/report/plugins/podman.py12
-rw-r--r--sos/report/plugins/postgresql.py18
-rw-r--r--sos/report/plugins/powerpc.py2
-rw-r--r--sos/report/plugins/process.py19
-rw-r--r--sos/report/plugins/processor.py14
-rw-r--r--sos/report/plugins/pulp.py20
-rw-r--r--sos/report/plugins/pulpcore.py12
-rw-r--r--sos/report/plugins/puppet.py2
-rw-r--r--sos/report/plugins/python.py6
-rw-r--r--sos/report/plugins/qaucli.py10
-rw-r--r--sos/report/plugins/qpid.py5
-rw-r--r--sos/report/plugins/qpid_dispatch.py4
-rw-r--r--sos/report/plugins/rasdaemon.py2
-rw-r--r--sos/report/plugins/rhui.py2
-rw-r--r--sos/report/plugins/rpm.py2
-rw-r--r--sos/report/plugins/rpmostree.py2
-rw-r--r--sos/report/plugins/s390.py4
-rw-r--r--sos/report/plugins/saphana.py32
-rw-r--r--sos/report/plugins/sapnw.py46
-rw-r--r--sos/report/plugins/sar.py12
-rw-r--r--sos/report/plugins/sas3ircu.py4
-rw-r--r--sos/report/plugins/scsi.py2
-rw-r--r--sos/report/plugins/seagate_ses.py4
-rw-r--r--sos/report/plugins/selinux.py2
-rw-r--r--sos/report/plugins/shmcli.py22
-rw-r--r--sos/report/plugins/slurm.py6
-rw-r--r--sos/report/plugins/smclient.py4
-rw-r--r--sos/report/plugins/sos_extras.py12
-rw-r--r--sos/report/plugins/storcli.py8
-rw-r--r--sos/report/plugins/stratis.py2
-rw-r--r--sos/report/plugins/subscription_manager.py23
-rw-r--r--sos/report/plugins/tomcat.py4
-rw-r--r--sos/report/plugins/ubuntu.py2
-rw-r--r--sos/report/plugins/ultrapath.py4
-rw-r--r--sos/report/plugins/vault.py3
-rw-r--r--sos/report/plugins/vdo.py2
-rw-r--r--sos/report/plugins/vdsm.py12
-rw-r--r--sos/report/plugins/vectordev.py2
-rw-r--r--sos/report/plugins/vhostmd.py5
-rw-r--r--sos/report/plugins/virsh.py12
-rw-r--r--sos/report/plugins/vmware.py4
-rw-r--r--sos/report/plugins/watchdog.py4
-rw-r--r--sos/report/plugins/xfs.py4
-rw-r--r--sos/report/plugins/zfs.py2
-rw-r--r--sos/report/plugins/zvm.py8
143 files changed, 752 insertions, 783 deletions
diff --git a/sos/report/plugins/__init__.py b/sos/report/plugins/__init__.py
index fc674be0..00fa15fc 100644
--- a/sos/report/plugins/__init__.py
+++ b/sos/report/plugins/__init__.py
@@ -134,32 +134,30 @@ class SoSPredicate(object):
optional prefix, suffix and value quoting.
"""
quotes = '"%s"'
- pstr = "dry_run=%s, " % self.dry_run
+ pstr = f"dry_run={self.dry_run}, "
kmods = self.kmods
kmods = [quotes % k for k in kmods] if quote else kmods
- pstr += "kmods=[%s], " % (",".join(kmods))
+ pstr += f"kmods=[{','.join(kmods)}], "
services = self.services
services = [quotes % s for s in services] if quote else services
- pstr += "services=[%s], " % (",".join(services))
+ pstr += f"services=[{','.join(services)}], "
pkgs = self.packages
pkgs = [quotes % p for p in pkgs] if quote else pkgs
- pstr += "packages=[%s], " % (",".join(pkgs))
+ pstr += f"packages=[{','.join(pkgs)}], "
cmdoutputs = [
- "{ %s: %s, %s: %s }" % (quotes % "cmd",
- quotes % cmdoutput['cmd'],
- quotes % "output",
- quotes % cmdoutput['output'])
+ f"{{ {quotes % 'cmd'}: {quotes % cmdoutput['cmd']}, "
+ f"{quotes % 'output'}: {quotes % cmdoutput['output']} }}"
for cmdoutput in self.cmd_outputs
]
- pstr += "cmdoutputs=[%s], " % (",".join(cmdoutputs))
+ pstr += f"cmdoutputs=[{','.join(cmdoutputs)}], "
arches = self.arch
arches = [quotes % a for a in arches] if quote else arches
- pstr += "arches=[%s]" % (",".join(arches))
+ pstr += f"arches=[{','.join(arches)}]"
return prefix + pstr + suffix
@@ -269,7 +267,7 @@ class SoSPredicate(object):
if not res:
self._failed_or_forbidden(
'cmd_outputs',
- "%s: %s" % (cmd['cmd'], cmd['output'])
+ f"{cmd['cmd']}: {cmd['output']}"
)
return self._check_required_state(_cmds, self.required['cmd_outputs'])
@@ -281,7 +279,7 @@ class SoSPredicate(object):
# see if the system's reported architecture is in the last of 'allowed'
# arches requested by the predicate
_arch = self._owner.policy.get_arch()
- regex = '(?:%s)' % '|'.join(self.arch)
+ regex = f'(?:{"|".join(self.arch)})'
if self.required['arch'] == 'none':
if re.match(regex, _arch):
self._forbidden['architecture'].append(_arch)
@@ -391,7 +389,7 @@ class SoSCommand(object):
def __str__(self):
"""Return a human readable string representation of this SoSCommand
"""
- return ', '.join("%s=%r" % (param, val) for (param, val) in
+ return ', '.join(f"{param}={val}" for (param, val) in
sorted(self.__dict__.items()))
@@ -443,10 +441,10 @@ class PluginOpt():
def __str__(self):
items = [
- 'name=%s' % self.name,
- 'desc=\'%s\'' % self.desc,
- 'value=%s' % self.value,
- 'default=%s' % self.default
+ f'name={self.name}',
+ f'desc=\'{self.desc}\'',
+ f'value={self.value}',
+ f'default={self.default}'
]
return '(' + ', '.join(items) + ')'
@@ -470,10 +468,8 @@ class PluginOpt():
elif t.__name__ == 'int':
valid.append("integer values")
raise Exception(
- "Plugin option '%s.%s' takes %s, not %s" % (
- self.plugin, self.name, ', '.join(valid),
- type(val).__name__
- )
+ f"Plugin option '{self.plugin}.{self.name}' takes "
+ f"{', '.join(valid)}, not {type(val).__name__}"
)
self.value = val
@@ -636,8 +632,8 @@ class Plugin():
"Environment variables for Plugin must be specified by dict"
)
self.default_environment = env_vars
- self._log_debug("Default environment for all commands now set to %s"
- % self.default_environment)
+ self._log_debug("Default environment for all commands now set to "
+ f"{self.default_environment}")
def add_default_cmd_environment(self, env_vars):
"""
@@ -650,7 +646,7 @@ class Plugin():
"""
if not isinstance(env_vars, dict):
raise TypeError("Environment variables must be added via dict")
- self._log_debug("Adding %s to default environment" % env_vars)
+ self._log_debug(f"Adding {env_vars} to default environment")
self.default_environment.update(env_vars)
def _get_cmd_environment(self, env=None):
@@ -778,8 +774,8 @@ class Plugin():
@classmethod
def display_plugin_help(cls, section):
from sos.help import TERMSIZE
- section.set_title("%s Plugin Information - %s"
- % (cls.plugin_name.title(), cls.short_desc))
+ section.set_title(f"{cls.plugin_name.title()} Plugin Information - "
+ f"{cls.short_desc}")
missing = '\nDetailed information is not available for this plugin.\n'
# Concatenate the docstrings of distro-specific plugins with their
@@ -794,7 +790,7 @@ class Plugin():
except Exception:
_doc = None
- section.add_text('\n %s' % _doc if _doc else missing)
+ section.add_text(f'\n {_doc if _doc else missing}')
if not any([cls.packages, cls.commands, cls.files, cls.kernel_mods,
cls.services, cls.containers]):
@@ -804,28 +800,27 @@ class Plugin():
'services']:
if getattr(cls, trig, None):
section.add_text(
- "Enabled by %s: %s"
- % (trig, ', '.join(getattr(cls, trig))),
+ f"Enabled by {trig}: {', '.join(getattr(cls, trig))}",
newline=False
)
if getattr(cls, 'containers'):
section.add_text(
- "Enabled by containers with names matching: %s"
- % ', '.join(c for c in cls.containers),
+ "Enabled by containers with names matching: "
+ f"{', '.join(c for c in cls.containers)}",
newline=False
)
if cls.profiles:
section.add_text(
- "Enabled with the following profiles: %s"
- % ', '.join(p for p in cls.profiles),
+ "Enabled with the following profiles: "
+ f"{', '.join(p for p in cls.profiles)}",
newline=False
)
if hasattr(cls, 'verify_packages'):
section.add_text(
- "\nVerfies packages (when using --verify): %s"
- % ', '.join(pkg for pkg in cls.verify_packages),
+ "\nVerfies packages (when using --verify): "
+ f"{', '.join(pkg for pkg in cls.verify_packages)}",
newline=False,
)
@@ -841,8 +836,8 @@ class Plugin():
optsec = section.add_section('Plugin Options')
optsec.add_text(
- "These options may be toggled or changed using '%s'"
- % bold("-k %s.option_name=$value" % cls.plugin_name)
+ "These options may be toggled or changed using "
+ f"'{bold(f'-k {cls.plugin_name}.option_name=$value')}'"
)
optsec.add_text(
bold((f"\n{' ':<4}{'Option Name':<20}{'Default':<30}"
@@ -881,13 +876,13 @@ class Plugin():
def display_self_help(cls, section):
section.set_title("SoS Plugin Detailed Help")
section.add_text(
- "Plugins are what define what collections occur for a given %s "
- "execution. Plugins are generally representative of a single "
- "system component (e.g. kernel), package (e.g. podman), or similar"
- " construct. Plugins will typically specify multiple files or "
- "directories to copy, as well as commands to execute and collect "
- "the output of for further analysis."
- % bold('sos report')
+ "Plugins are what define what collections occur for a given "
+ f"{bold('sos report')} execution. Plugins are generally "
+ "representative of a single system component (e.g. kernel), "
+ "package (e.g. podman), or similar construct. Plugins will "
+ "typically specify multiple files or directories to copy, as well"
+ " as commands to execute and collect the output of for further "
+ "analysis."
)
subsec = section.add_section('Plugin Enablement')
@@ -897,30 +892,28 @@ class Plugin():
'existing, a kernel module being loaded, etc...'
)
subsec.add_text(
- "Plugins may also be enabled or disabled by name using the %s or "
- "%s options respectively."
- % (bold('-e $name'), bold('-n $name'))
+ "Plugins may also be enabled or disabled by name using the "
+ f"{bold('-e $name')} or {bold('-n $name')} options respectively."
)
subsec.add_text(
"Certain plugins may only be available for specific distributions "
"or may behave differently on different distributions based on how"
" the component for that plugin is installed or how it operates."
- " When using %s, help will be displayed for the version of the "
- "plugin appropriate for your distribution."
- % bold('sos help report.plugins.$plugin')
+ f" When using {bold('sos help report.plugins.$plugin')}, help will"
+ " be displayed for the version of the plugin appropriate for your "
+ "distribution."
)
optsec = section.add_section('Using Plugin Options')
optsec.add_text(
"Many plugins support additional options to enable/disable or in "
"some other way modify the collections it makes. Plugin options "
- "are set using the %s syntax. Options that are on/off toggles "
- "may exclude setting a value, which will be interpreted as "
- "enabling that option.\n\nSee specific plugin help sections "
- "or %s for more information on these options"
- % (bold('-k $plugin_name.$option_name=$value'),
- bold('sos report -l'))
+ f"are set using the {bold('-k $plugin_name.$option_name=$value')} "
+ "syntax. Options that are on/off toggles may exclude setting a "
+ "value, which will be interpreted as enabling that option.\n\nSee"
+ f" specific plugin help sections or {bold('sos report -l')} for "
+ "more information on these options"
)
seealso = section.add_section('See Also')
@@ -937,10 +930,9 @@ class Plugin():
)
def _format_msg(self, msg):
- return "[plugin:%s] %s" % (self.name(),
- # safeguard against non-UTF logging, see
- # #2790 for reference
- msg.encode('utf-8', 'replace').decode())
+ # safeguard against non-UTF logging, see #2790 for reference
+ return (f"[plugin:{self.name()}] "
+ f"{msg.encode('utf-8', 'replace').decode()}")
def _log_error(self, msg):
self.soslog.error(self._format_msg(msg))
@@ -1147,7 +1139,7 @@ class Plugin():
"""
if pred is None:
pred = SoSPredicate(self)
- msg = "skipped command '%s': %s" % (cmd, pred.report_failure())
+ msg = f"skipped command '{cmd}': {pred.report_failure()}"
if changes:
msg += " Use '--allow-system-changes' to enable collection."
@@ -1171,10 +1163,10 @@ class Plugin():
if not self.executed_commands:
return 0
- self._log_debug("Scrubbing certs and keys for commands matching %s"
- % (cmd))
+ self._log_debug(
+ f"Scrubbing certs and keys for commands matching {cmd}")
- replace = "%s %s" % (_cert_replace, desc) if desc else _cert_replace
+ replace = f"{_cert_replace} {desc}" if desc else _cert_replace
return self.do_cmd_output_sub(cmd, _certmatch, replace)
@@ -1202,8 +1194,9 @@ class Plugin():
"""
globstr = '*' + cmd + '*'
pattern = regexp.pattern if hasattr(regexp, "pattern") else regexp
- self._log_debug("substituting '%s' for '%s' in commands matching '%s'"
- % (subst, pattern, globstr))
+ self._log_debug(
+ f"substituting '{subst}' for '{pattern}' in commands matching "
+ f"'{globstr}'")
if not self.executed_commands:
return 0
@@ -1216,11 +1209,11 @@ class Plugin():
continue
if called['binary'] == 'yes':
self._log_warn("Cannot apply regex substitution to binary"
- " output: '%s'" % called['exe'])
+ f" output: '{called['exe']}'")
continue
if fnmatch.fnmatch(called['cmd'], globstr):
path = os.path.join(self.commons['cmddir'], called['file'])
- self._log_debug("applying substitution to '%s'" % path)
+ self._log_debug(f"applying substitution to '{path}'")
readable = self.archive.open_file(path)
result, replacements = re.subn(
regexp, subst, readable.read())
@@ -1249,10 +1242,10 @@ class Plugin():
:param desc: A description of the replaced content
:type desc: ``str``
"""
- self._log_debug("Scrubbing certs and keys for paths matching %s"
- % pathregex)
+ self._log_debug("Scrubbing certs and keys for paths matching "
+ f"{pathregex}")
match = re.compile(pathregex).match
- replace = "%s %s" % (_cert_replace, desc) if desc else _cert_replace
+ replace = f"{_cert_replace} {desc}" if desc else _cert_replace
file_list = [f for f in self.copied_files if match(f['srcpath'])]
for i in file_list:
path = i['dstpath']
@@ -1278,12 +1271,10 @@ class Plugin():
"""
try:
path = self._get_dest_for_srcpath(srcpath)
- self._log_debug("substituting scrpath '%s'" % srcpath)
- self._log_debug("substituting '%s' for '%s' in '%s'"
- % (subst,
- regexp.pattern if hasattr(regexp, "pattern")
- else regexp,
- path))
+ self._log_debug(f"substituting scrpath '{srcpath}'")
+ self._log_debug(f"substituting '{subst}' for '%s' in '{path}'"
+ % regexp.pattern if hasattr(regexp, "pattern")
+ else regexp)
if not path:
return 0
replacements = self.archive.do_file_sub(path, regexp, subst)
@@ -1339,20 +1330,20 @@ class Plugin():
# trim leading /sysroot
if self.use_sysroot():
reldest = reldest[len(os.sep + os.pardir):]
- self._log_debug("made link target '%s' relative as '%s'"
- % (linkdest, reldest))
+ self._log_debug(f"made link target '{linkdest}' relative as "
+ f"'{reldest}'")
else:
reldest = linkdest
- self._log_debug("copying link '%s' pointing to '%s' with isdir=%s"
- % (srcpath, linkdest, self.path_isdir(absdest)))
+ self._log_debug(f"copying link '{srcpath}' pointing to '{linkdest}' "
+ f"with isdir={self.path_isdir(absdest)}")
dstpath = self.strip_sysroot(srcpath)
# use the relative target path in the tarball
self.archive.add_link(reldest, dstpath)
if self.path_isdir(absdest):
- self._log_debug("link '%s' is a directory, skipping..." % linkdest)
+ self._log_debug(f"link '{linkdest}' is a directory, skipping...")
return
self.copied_files.append({'srcpath': srcpath,
@@ -1366,14 +1357,13 @@ class Plugin():
os.stat(absdest)
except OSError as e:
if e.errno == 40:
- self._log_debug("link '%s' is part of a file system "
- "loop, skipping target..." % dstpath)
+ self._log_debug(f"link '{dstpath}' is part of a file system "
+ "loop, skipping target...")
return
# copy the symlink target translating relative targets
# to absolute paths to pass to _do_copy_path.
- self._log_debug("normalized link target '%s' as '%s'"
- % (linkdest, absdest))
+ self._log_debug(f"normalized link target '{linkdest}' as '{absdest}'")
# skip recursive copying of symlink pointing to itself.
if (absdest != srcpath):
@@ -1383,24 +1373,24 @@ class Plugin():
self.policy._in_container)
self._do_copy_path(absdest, force=force)
else:
- self._log_debug("link '%s' points to itself, skipping target..."
- % linkdest)
+ self._log_debug(f"link '{linkdest}' points to itself, skipping "
+ "target...")
def _copy_dir(self, srcpath):
try:
for name in self.listdir(srcpath):
- self._log_debug("recursively adding '%s' from '%s'"
- % (name, srcpath))
+ self._log_debug(f"recursively adding '{name}' from "
+ f"'{srcpath}'")
path = os.path.join(srcpath, name)
self._do_copy_path(path)
except OSError as e:
if e.errno == errno.EPERM or errno.EACCES:
msg = "Permission denied"
- self._log_warn("_copy_dir: '%s' %s" % (srcpath, msg))
+ self._log_warn(f"_copy_dir: '{srcpath}' {msg}")
return
if e.errno == errno.ELOOP:
msg = "Too many levels of symbolic links copying"
- self._log_error("_copy_dir: %s '%s'" % (msg, srcpath))
+ self._log_error(f"_copy_dir: {msg} '{srcpath}'")
return
raise
@@ -1452,7 +1442,7 @@ class Plugin():
return None
if self._is_forbidden_path(srcpath):
- self._log_debug("skipping forbidden path '%s'" % srcpath)
+ self._log_debug(f"skipping forbidden path '{srcpath}'")
return None
if not dest:
@@ -1464,7 +1454,7 @@ class Plugin():
try:
st = os.lstat(srcpath)
except (OSError, IOError):
- self._log_info("failed to stat '%s'" % srcpath)
+ self._log_info(f"failed to stat '{srcpath}'")
return None
if stat.S_ISLNK(st.st_mode):
@@ -1482,13 +1472,12 @@ class Plugin():
# handle special nodes (block, char, fifo, socket)
if not (stat.S_ISREG(st.st_mode) or stat.S_ISDIR(st.st_mode)):
ntype = _node_type(st)
- self._log_debug("creating %s node at archive:'%s'"
- % (ntype, dest))
+ self._log_debug(f"creating {ntype} node at archive:'{dest}'")
self._copy_node(dest, st)
return None
# if we get here, it's definitely a regular file (not a symlink or dir)
- self._log_debug("copying path '%s' to archive:'%s'" % (srcpath, dest))
+ self._log_debug(f"copying path '{srcpath}' to archive:'{dest}'")
# if not readable(srcpath)
if not st.st_mode & 0o444:
@@ -1519,7 +1508,7 @@ class Plugin():
forbidden = [self.path_join(f) for f in forbidden]
for forbid in forbidden:
- self._log_info("adding forbidden path '%s'" % forbid)
+ self._log_info(f"adding forbidden path '{forbid}'")
if "*" in forbid:
# calling translate() here on a dir-level path will break the
# re.match() call during path comparison
@@ -1681,11 +1670,11 @@ class Plugin():
since = self.get_option('since')
logarchive_pattern = re.compile(r'.*((\.(zip|gz|bz2|xz))|[-.][\d]+)$')
- configfile_pattern = re.compile(r"^%s/*" % self.path_join("etc"))
+ configfile_pattern = re.compile(fr"^{self.path_join('etc')}/*")
if not self.test_predicate(pred=pred):
- self._log_info("skipped copy spec '%s' due to predicate (%s)" %
- (copyspecs, self.get_predicate(pred=pred)))
+ self._log_info(f"skipped copy spec '{copyspecs}' due to predicate"
+ f" ({self.get_predicate(pred=pred)})")
return None
if sizelimit is None:
@@ -1754,7 +1743,7 @@ class Plugin():
if sizelimit:
# to get just the size, stat requires a literal '%s'
# which conflicts with python string formatting
- cmd = "stat -c %s " + copyspec
+ cmd = f"stat -c %s {copyspec}"
ret = self.exec_cmd(cmd, container=con)
if ret['status'] == 0:
try:
@@ -1763,24 +1752,23 @@ class Plugin():
_tail = True
except ValueError:
self._log_info(
- "unable to determine size of '%s' in "
- "container '%s'. Skipping collection."
- % (copyspec, con)
+ f"unable to determine size of '{copyspec}'"
+ f" in container '{con}'. Skipping "
+ "collection."
)
continue
else:
self._log_debug(
- "stat of '%s' in container '%s' failed, "
- "skipping collection: %s"
- % (copyspec, con, ret['output'])
- )
+ f"stat of '{copyspec}' in container '{con}' "
+ "failed, skipping collection: "
+ f"{ret['output']}")
continue
self.container_copy_paths.append(
(con, copyspec, sizelimit, _tail, _spec_tags)
)
self._log_info(
- "added collection of '%s' from container '%s'"
- % (copyspec, con)
+ f"added collection of '{copyspec}' from container "
+ f"'{con}'"
)
# break out of the normal flow here as container file
# copies are done via command execution, not raw cp/mv
@@ -1820,20 +1808,20 @@ class Plugin():
for _file in files:
if _file in self.copy_paths:
- self._log_debug("skipping redundant file '%s'" % _file)
+ self._log_debug(f"skipping redundant file '{_file}'")
continue
if self._is_forbidden_path(_file):
- self._log_debug("skipping forbidden path '%s'" % _file)
+ self._log_debug(f"skipping forbidden path '{_file}'")
continue
if self._is_policy_forbidden_path(_file):
- self._log_debug("skipping policy forbidden path '%s'"
- % _file)
+ self._log_debug(
+ f"skipping policy forbidden path '{_file}'")
continue
if self._is_skipped_path(_file):
- self._log_debug("skipping excluded path '%s'" % _file)
+ self._log_debug(f"skipping excluded path '{_file}'")
continue
if limit_reached:
- self._log_info("skipping '%s' over size limit" % _file)
+ self._log_info(f"skipping '{_file}' over size limit")
continue
try:
@@ -1844,7 +1832,7 @@ class Plugin():
if self.path_islink(_file):
file_size = 0
else:
- self._log_info("failed to stat '%s', skipping" % _file)
+ self._log_info(f"failed to stat '{_file}', skipping")
continue
current_size += file_size
@@ -1854,14 +1842,14 @@ class Plugin():
if tailit:
if file_is_binary(_file):
self._log_info(
- "File '%s' is over size limit and is binary. "
- "Skipping collection." % _file
+ f"File '{_file}' is over size limit and is "
+ "binary. Skipping collection."
)
continue
self._log_info(
- "File '%s' is over size limit, will instead tail "
- "the file during collection phase." % _file
+ f"File '{_file}' is over size limit, will instead "
+ "tail the file during collection phase."
)
add_size = sizelimit + file_size - current_size
self._tail_files_list.append((_file, add_size))
@@ -1950,14 +1938,14 @@ class Plugin():
whitelist = [whitelist]
_devs = [d for d in _devs if
- any(re.match("(.*)?%s" % wl, d) for wl in whitelist)]
+ any(re.match(f"(.*)?{wl}", d) for wl in whitelist)]
if blacklist:
if isinstance(blacklist, str):
blacklist = [blacklist]
_devs = [d for d in _devs if not
- any(re.match("(.*)?%s" % bl, d) for bl in blacklist)]
+ any(re.match(f"(.*)?{bl}", d) for bl in blacklist)]
_dev_tags.extend(tags)
self._add_device_cmd(cmds, _devs, timeout=timeout,
@@ -2005,11 +1993,11 @@ class Plugin():
# matching with file paths, which sysadmins are almost guaranteed
# to assume will use shell-style unix matching
if fnmatch.fnmatch(soscmd.cmd, _skip_cmd):
- self._log_debug("skipping excluded command '%s'" % soscmd.cmd)
+ self._log_debug(f"skipping excluded command '{soscmd.cmd}'")
return
if self.test_predicate(cmd=True, pred=pred):
self.collect_cmds.append(soscmd)
- self._log_info("added cmd output '%s'" % soscmd.cmd)
+ self._log_info(f"added cmd output '{soscmd.cmd}'")
else:
self.log_skipped_cmd(soscmd.cmd, pred, changes=soscmd.changes)
@@ -2108,9 +2096,9 @@ class Plugin():
container_cmd = (ocmd, container)
cmd = self.fmt_container_cmd(container, cmd)
if not cmd:
- self._log_debug("Skipping command '%s' as the requested "
- "container '%s' does not exist."
- % (ocmd, container))
+ self._log_debug(f"Skipping command '{ocmd}' as the "
+ f"requested container '{container}' does "
+ "not exist.")
continue
self._add_cmd_output(cmd=cmd, suggest_filename=suggest_filename,
root_symlink=root_symlink, timeout=timeout,
@@ -2197,7 +2185,7 @@ class Plugin():
plugin_dir = self.name()
if subdir:
- plugin_dir += "/%s" % subdir
+ plugin_dir += f"/{subdir}"
outdir = os.path.join(self.commons['cmddir'], plugin_dir)
outfn = self._mangle_command(exe)
@@ -2207,7 +2195,7 @@ class Plugin():
inc = 1
name_max = self.archive.name_max()
while True:
- suffix = ".%d" % inc
+ suffix = f".{inc}"
newfn = outfn
if name_max < len(newfn)+len(suffix):
newfn = newfn[:(name_max-len(newfn)-len(suffix))]
@@ -2262,8 +2250,8 @@ class Plugin():
"""
if not self.test_predicate(cmd=False, pred=pred):
- self._log_info("skipped string due to predicate (%s)" %
- (self.get_predicate(pred=pred)))
+ self._log_info("skipped string due to predicate "
+ f"({self.get_predicate(pred=pred)})")
return
sos_dir = 'sos_commands' if plug_dir else 'sos_strings'
@@ -2273,7 +2261,7 @@ class Plugin():
tags = [tags]
self.copy_strings.append((content, filename, tags))
- self._log_debug("added string as '%s'" % filename)
+ self._log_debug(f"added string as '{filename}'")
def _collect_cmd_output(self, cmd, suggest_filename=None,
root_symlink=False, timeout=None,
@@ -2347,8 +2335,7 @@ class Plugin():
outfn_strip = outfn[len(self.commons['cmddir'])+1:]
if to_file:
- self._log_debug("collecting '%s' output directly to disk"
- % cmd)
+ self._log_debug(f"collecting '{cmd}' output directly to disk")
self.archive.check_path(outfn, P_FILE)
out_file = os.path.join(self.archive.get_archive_path(), outfn)
else:
@@ -2367,12 +2354,12 @@ class Plugin():
run_time = end - start
if result['status'] == 124:
- warn = "command '%s' timed out after %ds" % (cmd, timeout)
+ warn = f"command '{cmd}' timed out after {timeout}s"
self._log_warn(warn)
if to_file:
msg = (" - output up until the timeout may be available at "
- "%s" % outfn)
- self._log_debug("%s%s" % (warn, msg))
+ f"{outfn}")
+ self._log_debug(f"{warn}{msg}")
manifest_cmd = {
'command': cmd.split(' ')[0],
@@ -2393,16 +2380,15 @@ class Plugin():
# automatically retry chroot'ed commands in the host namespace
if root and root != '/':
if self.commons['cmdlineopts'].chroot != 'always':
- self._log_info("command '%s' not found in %s - "
- "re-trying in host root"
- % (cmd.split()[0], root))
+ self._log_info(f"command '{cmd.split()[0]}' not found in "
+ f"{root} - re-trying in host root")
result = sos_get_command_output(
cmd, timeout=timeout, chroot=False, chdir=runat,
env=env, binary=binary, sizelimit=sizelimit,
poller=self.check_timeout, to_file=out_file
)
run_time = time() - start
- self._log_debug("could not run '%s': command not found" % cmd)
+ self._log_debug(f"could not run '{cmd}': command not found")
# Exit here if the command was not found in the chroot check above
# as otherwise we will create a blank file in the archive
if result['status'] in [126, 127]:
@@ -2410,12 +2396,12 @@ class Plugin():
self.manifest.commands.append(manifest_cmd)
return result
- self._log_debug("collected output of '%s' in %s (changes=%s)"
- % (cmd.split()[0], run_time, changes))
+ self._log_debug(f"collected output of '{cmd.split()[0]}' in {run_time}"
+ f" (changes={changes})")
if result['truncated']:
- self._log_info("collected output of '%s' was truncated"
- % cmd.split()[0])
+ self._log_info(f"collected output of '{cmd.split()[0]}' was "
+ "truncated")
linkfn = outfn
outfn = outfn.replace('sos_commands', 'sos_strings') + '.tailed'
@@ -2590,14 +2576,14 @@ class Plugin():
if container:
if self._get_container_runtime() is None:
- self._log_info("Cannot run cmd '%s' in container %s: no "
- "runtime detected on host." % (cmd, container))
+ self._log_info(f"Cannot run cmd '{cmd}' in container "
+ f"{container}: no runtime detected on host.")
return _default
if self.container_exists(container):
cmd = self.fmt_container_cmd(container, cmd, quotecmd)
else:
- self._log_info("Cannot run cmd '%s' in container %s: no such "
- "container is running." % (cmd, container))
+ self._log_info(f"Cannot run cmd '{cmd}' in container "
+ f"{container}: no such container is running.")
return sos_get_command_output(cmd, timeout=timeout, chroot=root,
chdir=runat, binary=binary, env=_env,
@@ -2646,10 +2632,10 @@ class Plugin():
manifest['command'] = cmd.split(' ')[0]
manifest['parameters'] = cmd.split(' ')[1:]
- _cdir = "sos_containers/%s/sos_commands/%s" % (container, self.name())
- _outloc = "../../../../%s" % manifest['filepath']
+ _cdir = f"sos_containers/{container}/sos_commands/{self.name()}"
+ _outloc = f"../../../../{manifest['filepath']}"
cmdfn = self._mangle_command(cmd)
- conlnk = "%s/%s" % (_cdir, cmdfn)
+ conlnk = f"{_cdir}/{cmdfn}"
# If check_path return None, it means that the sym link already exits,
# so to avoid Error 17, trying to recreate, we will skip creation and
@@ -2884,7 +2870,7 @@ class Plugin():
return
for service in services:
- self.add_cmd_output("%s %s" % (query, service), **kwargs)
+ self.add_cmd_output(f"{query} {service}", **kwargs)
def add_journal(self, units=None, boot=None, since=None, until=None,
lines=None, allfields=False, output=None,
@@ -2955,7 +2941,7 @@ class Plugin():
if units:
for unit in units:
journal_cmd += unit_opt % unit
- tags.append("journal_%s" % unit)
+ tags.append(f"journal_{unit}")
if identifier:
journal_cmd += identifier_opt % identifier
@@ -2985,7 +2971,7 @@ class Plugin():
if output:
journal_cmd += output_opt % output
- self._log_debug("collecting journal: %s" % journal_cmd)
+ self._log_debug(f"collecting journal: {journal_cmd}")
self._add_cmd_output(cmd=journal_cmd, timeout=timeout,
sizelimit=log_size, pred=pred, tags=tags,
priority=priority)
@@ -3036,7 +3022,7 @@ class Plugin():
def _collect_copy_specs(self):
for path in sorted(self.copy_paths, reverse=True):
- self._log_info("collecting path '%s'" % path)
+ self._log_info(f"collecting path '{path}'")
self._do_copy_path(path)
self.generate_copyspec_tags()
@@ -3061,9 +3047,9 @@ class Plugin():
return
for contup in self.container_copy_paths:
con, path, sizelimit, tailit, tags = contup
- self._log_info("collecting '%s' from container '%s'" % (path, con))
+ self._log_info(f"collecting '{path}' from container '{con}'")
- arcdest = "sos_containers/%s/%s" % (con, path.lstrip('/'))
+ arcdest = f"sos_containers/{con}/{path.lstrip('/')}"
self.archive.check_path(arcdest, P_FILE)
dest = self.archive.dest_path(arcdest)
@@ -3079,14 +3065,14 @@ class Plugin():
self.archive.add_string(cpret['output'], arcdest)
self._add_container_file_to_manifest(con, path, arcdest, tags)
else:
- self._log_info("error copying '%s' from container '%s': %s"
- % (path, con, cpret['output']))
+ self._log_info(f"error copying '{path}' from container "
+ f"'{con}': {cpret['output']}")
def _collect_cmds(self):
self.collect_cmds.sort(key=lambda x: x.priority)
for soscmd in self.collect_cmds:
self._log_debug("unpacked command: " + soscmd.__str__())
- self._log_info("collecting output of '%s'" % soscmd.cmd)
+ self._log_info(f"collecting output of '{soscmd.cmd}'")
self._collect_cmd_output(**soscmd.__dict__)
def _collect_tailed_files(self):
@@ -3108,7 +3094,7 @@ class Plugin():
for string, file_name, tags in self.copy_strings:
if self._timeout_hit:
return
- self._log_info("collecting string as '%s'" % file_name)
+ self._log_info(f"collecting string as '{file_name}'")
try:
self.archive.add_string(string, file_name)
_name = file_name.split('/')[-1].replace('.', '_')
@@ -3117,8 +3103,7 @@ class Plugin():
'tags': tags
}
except Exception as e:
- self._log_debug("could not add string '%s': %s"
- % (file_name, e))
+ self._log_debug(f"could not add string '{file_name}': {e}")
def _collect_manual(self):
"""Kick off manual collections performed by the plugin. These manual
@@ -3193,8 +3178,8 @@ class Plugin():
self._collect_strings()
self._collect_cmds()
self._collect_manual()
- fields = (self.name(), time() - start)
- self._log_debug("collected plugin '%s' in %s" % fields)
+ self._log_debug(f"collected plugin '{self.name()}' in "
+ f"{time() - start}")
def get_description(self):
"""This function will return the description for the plugin"""
@@ -3272,7 +3257,7 @@ class Plugin():
"""
if self.architectures is None:
return True
- regex = '(?:%s)' % '|'.join(self.architectures)
+ regex = f'(?:{"|".join(self.architectures)})'
return re.match(regex, self.policy.get_arch())
def default_enabled(self):
@@ -3458,8 +3443,7 @@ class Plugin():
# Regex initialization outside of for loop
if ns_pattern:
pattern = (
- '(?:%s$)' % '$|'.join(ns_pattern.split()).replace('*', '.*')
- )
+ f'(?:{"$|".join(ns_pattern.split()).replace("*", ".*")}$)')
for ns in ns_list:
# if ns_pattern defined, skip namespaces not matching the pattern
if ns_pattern and not bool(re.match(pattern, ns)):
@@ -3472,8 +3456,7 @@ class Plugin():
if ns_max:
if len(out_ns) == ns_max:
self._log_warn("Limiting namespace iteration "
- "to first %s namespaces found"
- % ns_max)
+ f"to first {ns_max} namespaces found")
break
return out_ns
@@ -3538,7 +3521,7 @@ def import_plugin(name, superclasses=None):
module. superclasses should be a tuple of valid superclasses to import,
this defaults to (Plugin,).
"""
- plugin_fqname = "sos.report.plugins.%s" % name
+ plugin_fqname = f"sos.report.plugins.{name}"
if not superclasses:
superclasses = (Plugin,)
return import_module(plugin_fqname, superclasses)
diff --git a/sos/report/plugins/abrt.py b/sos/report/plugins/abrt.py
index efc84499..8a9e0651 100644
--- a/sos/report/plugins/abrt.py
+++ b/sos/report/plugins/abrt.py
@@ -32,8 +32,8 @@ class Abrt(Plugin, RedHatPlugin):
if self.get_option("detailed") and abrt_list['status'] == 0:
for line in abrt_list["output"].splitlines():
if line.startswith("Directory"):
- self.add_cmd_output("abrt-cli info -d '%s'"
- % line.split()[1])
+ self.add_cmd_output("abrt-cli info -d "
+ f"'{line.split()[1]}'")
self.add_copy_spec([
"/etc/abrt/abrt.conf",
diff --git a/sos/report/plugins/alternatives.py b/sos/report/plugins/alternatives.py
index 7c4dc1ae..181d4b24 100644
--- a/sos/report/plugins/alternatives.py
+++ b/sos/report/plugins/alternatives.py
@@ -20,7 +20,7 @@ class Alternatives(Plugin):
def setup(self):
- self.add_cmd_output('%s --version' % self.alternatives_cmd)
+ self.add_cmd_output(f'{self.alternatives_cmd} --version')
alts = []
ignore = [
@@ -37,7 +37,7 @@ class Alternatives(Plugin):
alt = line.split()[0]
if alt not in ignore:
alts.append(alt)
- disp_cmd = "%s --display %s" % (self.alternatives_cmd, "%s")
+ disp_cmd = f"{self.alternatives_cmd} --display %s"
self.add_cmd_output([disp_cmd % alt for alt in alts])
@@ -47,7 +47,7 @@ class RedHatAlternatives(Alternatives, RedHatPlugin):
commands = ('alternatives',)
alternatives_cmd = 'alternatives'
- alternatives_list = '%s --list' % alternatives_cmd
+ alternatives_list = f'{alternatives_cmd} --list'
def setup(self):
@@ -66,7 +66,7 @@ class UbuntuAlternatives(Alternatives, UbuntuPlugin):
commands = ('update-alternatives',)
alternatives_cmd = 'update-alternatives'
- alternatives_list = '%s --get-selections' % alternatives_cmd
+ alternatives_list = f'{alternatives_cmd} --get-selections'
def setup(self):
diff --git a/sos/report/plugins/apache.py b/sos/report/plugins/apache.py
index 3088355b..f759ea98 100644
--- a/sos/report/plugins/apache.py
+++ b/sos/report/plugins/apache.py
@@ -61,7 +61,7 @@ class Apache(Plugin):
'pulp'
]
self.add_forbidden_path([
- "/var/log/%s*/%s*" % (self.apachepkg, sub) for sub in subdirs
+ f"/var/log/{self.apachepkg}*/{sub}*" for sub in subdirs
])
@@ -98,7 +98,7 @@ class RedHatApache(Apache, RedHatPlugin):
# Extrapolate all top-level config directories for each version, and
# relevant config files within each
- etcdirs = ["/etc/httpd%s" % ver for ver in vers]
+ etcdirs = [f"/etc/httpd{ver}" for ver in vers]
confs = [
"conf/*.conf",
"conf.d/*.conf",
@@ -107,7 +107,7 @@ class RedHatApache(Apache, RedHatPlugin):
# Extrapolate top-level logging directories for each version, and the
# relevant log files within each
- logdirs = ["/var/log/httpd%s" % ver for ver in vers]
+ logdirs = [f"/var/log/httpd{ver}" for ver in vers]
logs = [
"access_log",
"error_log",
@@ -116,19 +116,19 @@ class RedHatApache(Apache, RedHatPlugin):
]
self.add_forbidden_path([
- "%s/conf/password.conf" % etc for etc in etcdirs
+ f"{etc}/conf/password.conf" for etc in etcdirs
])
for edir in etcdirs:
for conf in confs:
- self.add_copy_spec("%s/%s" % (edir, conf), tags="httpd_conf")
+ self.add_copy_spec(f"{edir}/{conf}", tags="httpd_conf")
if self.get_option("log") or self.get_option("all_logs"):
self.add_copy_spec(logdirs)
else:
for ldir in logdirs:
for log in logs:
- self.add_copy_spec("%s/%s" % (ldir, log))
+ self.add_copy_spec(f"{ldir}/{log}")
self.add_service_status('httpd', tags='systemctl_httpd')
diff --git a/sos/report/plugins/auditd.py b/sos/report/plugins/auditd.py
index 59bb206b..503312ae 100644
--- a/sos/report/plugins/auditd.py
+++ b/sos/report/plugins/auditd.py
@@ -45,8 +45,8 @@ class Auditd(Plugin, IndependentPlugin):
if words[0].strip() == 'log_file':
log_file = words[1].strip()
except IOError as error:
- self._log_error('Could not open conf file %s: %s' %
- (config_file, error))
+ self._log_error(f'Could not open conf file {config_file}: '
+ f'{error}')
if not self.get_option("all_logs"):
self.add_copy_spec(log_file)
diff --git a/sos/report/plugins/block.py b/sos/report/plugins/block.py
index 621c6010..ca0a7aef 100644
--- a/sos/report/plugins/block.py
+++ b/sos/report/plugins/block.py
@@ -65,6 +65,6 @@ class Block(Plugin, IndependentPlugin):
for line in lsblk['output'].splitlines():
if 'crypto_LUKS' in line:
dev = line.split()[0]
- self.add_cmd_output('cryptsetup luksDump /dev/%s' % dev)
+ self.add_cmd_output(f'cryptsetup luksDump /dev/{dev}')
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/boot.py b/sos/report/plugins/boot.py
index 9bb1b28e..7b83ea0b 100644
--- a/sos/report/plugins/boot.py
+++ b/sos/report/plugins/boot.py
@@ -51,8 +51,8 @@ class Boot(Plugin, IndependentPlugin):
for image in glob('/boot/initr*.img*'):
if image[-9:] == "kdump.img":
continue
- self.add_cmd_output("lsinitrd %s" % image, priority=100)
- self.add_cmd_output("lsinitramfs -l %s" % image, priority=100)
+ self.add_cmd_output(f"lsinitrd {image}", priority=100)
+ self.add_cmd_output(f"lsinitramfs -l {image}", priority=100)
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/buildah.py b/sos/report/plugins/buildah.py
index 4b8b3b0a..9df61e07 100644
--- a/sos/report/plugins/buildah.py
+++ b/sos/report/plugins/buildah.py
@@ -28,7 +28,7 @@ class Buildah(Plugin, RedHatPlugin):
'version'
]
- self.add_cmd_output(["buildah %s" % sub for sub in subcmds])
+ self.add_cmd_output([f"buildah {sub}" for sub in subcmds])
def make_chowdah(aurdah):
chowdah = self.exec_cmd(aurdah)
@@ -41,14 +41,14 @@ class Buildah(Plugin, RedHatPlugin):
for containah in containahs['auutput'].splitlines():
# obligatory Tom Brady
goat = containah.split()[-1]
- self.add_cmd_output('buildah inspect -t container %s' % goat,
+ self.add_cmd_output(f'buildah inspect -t container {goat}',
subdir='containers')
pitchez = make_chowdah('buildah images -n')
if pitchez['is_wicked_pissah']:
for pitchah in pitchez['auutput'].splitlines():
brady = pitchah.split()[1]
- self.add_cmd_output('buildah inspect -t image %s' % brady,
+ self.add_cmd_output(f'buildah inspect -t image {brady}',
subdir='images')
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/candlepin.py b/sos/report/plugins/candlepin.py
index a4961ced..0311eeb6 100644
--- a/sos/report/plugins/candlepin.py
+++ b/sos/report/plugins/candlepin.py
@@ -134,7 +134,7 @@ class Candlepin(Plugin, RedHatPlugin):
self.do_file_sub("/var/log/candlepin/cpdb.log", cpdbreg, repl)
for key in ["trustStorePassword", "keyStorePassword"]:
self.do_file_sub("/etc/candlepin/broker.xml",
- r"(%s)=(\w*)([;<])" % key,
+ fr"({key})=(\w*)([;<])",
r"\1=********\3")
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/canonical_livepatch_onprem.py b/sos/report/plugins/canonical_livepatch_onprem.py
index 2bf82b84..cb36c6a5 100644
--- a/sos/report/plugins/canonical_livepatch_onprem.py
+++ b/sos/report/plugins/canonical_livepatch_onprem.py
@@ -32,7 +32,7 @@ class CanonicaLivepatchOnprem(Plugin, UbuntuPlugin):
]
# Redact simple yaml style "key: value".
- keys_regex = r"(^(-|\s)*(%s)\s*:\s*)(.*)" % "|".join(protect_keys)
+ keys_regex = fr"(^(-|\s)*({'|'.join(protect_keys)})\s*:\s*)(.*)"
sub_regex = r"\1*********"
self.do_path_regex_sub(onprem_conf, keys_regex, sub_regex)
diff --git a/sos/report/plugins/ceph_common.py b/sos/report/plugins/ceph_common.py
index 37df9aae..ca17398d 100644
--- a/sos/report/plugins/ceph_common.py
+++ b/sos/report/plugins/ceph_common.py
@@ -31,9 +31,9 @@ class CephCommon(Plugin, RedHatPlugin, UbuntuPlugin):
services = (
'ceph-nfs@pacemaker',
- 'ceph-mds@%s' % ceph_hostname,
- 'ceph-mon@%s' % ceph_hostname,
- 'ceph-mgr@%s' % ceph_hostname,
+ f'ceph-mds@{ceph_hostname}',
+ f'ceph-mon@{ceph_hostname}',
+ f'ceph-mgr@{ceph_hostname}',
'ceph-radosgw@*',
'ceph-osd@*'
)
diff --git a/sos/report/plugins/collectd.py b/sos/report/plugins/collectd.py
index 0ecb19bf..2f192192 100644
--- a/sos/report/plugins/collectd.py
+++ b/sos/report/plugins/collectd.py
@@ -40,10 +40,10 @@ class Collectd(Plugin, IndependentPlugin):
with open(cfile, 'r', encoding='UTF-8') as file:
for line in file:
if plugin.match(line):
- self.add_alert("Active Plugin found: %s" %
- line.split()[-1])
+ self.add_alert("Active Plugin found: "
+ f"{line.split()[-1]}")
except IOError as err:
- self._log_warn("could not open /etc/collectd.conf: %s" % err)
+ self._log_warn(f"could not open /etc/collectd.conf: {err}")
def postproc(self):
# add these to protect_keys if need be:
@@ -52,7 +52,7 @@ class Collectd(Plugin, IndependentPlugin):
"Password", "User",
"[<]*URL", "Address"
]
- regexp = r"(^[#]*\s*(%s)\s* \s*)(.*)" % "|".join(protect_keys)
+ regexp = fr"(^[#]*\s*({'|'.join(protect_keys)})\s* \s*)(.*)"
self.do_path_regex_sub(
"/etc/collectd.d/*.conf",
regexp, r'\1"*********"'
diff --git a/sos/report/plugins/composer.py b/sos/report/plugins/composer.py
index d58e3d7d..495bb847 100644
--- a/sos/report/plugins/composer.py
+++ b/sos/report/plugins/composer.py
@@ -43,17 +43,17 @@ class Composer(Plugin, IndependentPlugin):
])
blueprints = self._get_entries("composer-cli blueprints list")
for blueprint in blueprints:
- self.add_cmd_output("composer-cli blueprints show %s" % blueprint)
+ self.add_cmd_output(f"composer-cli blueprints show {blueprint}")
sources = self._get_entries("composer-cli sources list")
for src in sources:
- self.add_cmd_output("composer-cli sources info %s" % src)
+ self.add_cmd_output(f"composer-cli sources info {src}")
composes = self._get_entries("composer-cli compose list")
for compose in composes:
# the first column contains the compose id
self.add_cmd_output(
- "composer-cli compose log %s" % compose.split(" ")[0]
+ f"composer-cli compose log {compose.split(' ')[0]}"
)
self.add_journal(units=[
diff --git a/sos/report/plugins/console.py b/sos/report/plugins/console.py
index 9717993b..7ef7ac58 100644
--- a/sos/report/plugins/console.py
+++ b/sos/report/plugins/console.py
@@ -23,7 +23,7 @@ class Console(Plugin, RedHatPlugin, UbuntuPlugin):
self.add_cmd_output("fgconsole")
self.add_cmd_output([
- "kbdinfo -C %s gkbled" % tty for tty in glob("/dev/tty[0-8]")
+ f"kbdinfo -C {tty} gkbled" for tty in glob("/dev/tty[0-8]")
])
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/containers_common.py b/sos/report/plugins/containers_common.py
index 39e9b1a0..e76ac6e9 100644
--- a/sos/report/plugins/containers_common.py
+++ b/sos/report/plugins/containers_common.py
@@ -64,13 +64,14 @@ class ContainersCommon(Plugin, RedHatPlugin, UbuntuPlugin):
]
for user in users_list:
# collect user's containers' config
+ expanded_user = os.path.expanduser(f'~{user}')
self.add_copy_spec(
- '%s/.config/containers/' % (os.path.expanduser('~%s' % user)))
+ f'{expanded_user}/.config/containers/')
# collect user-status
- self.add_cmd_output('loginctl user-status %s' % user)
+ self.add_cmd_output(f'loginctl user-status {user}')
# collect the user's related commands
self.add_cmd_output([
- 'machinectl -q shell %s@ /usr/bin/%s' % (user, cmd)
+ f'machinectl -q shell {user}@ /usr/bin/{cmd}'
for cmd in user_subcmds
], foreground=True)
diff --git a/sos/report/plugins/corosync.py b/sos/report/plugins/corosync.py
index 35afbe85..6a25806c 100644
--- a/sos/report/plugins/corosync.py
+++ b/sos/report/plugins/corosync.py
@@ -54,7 +54,7 @@ class Corosync(Plugin):
if re.match(pattern, line):
self.add_copy_spec(re.search(pattern, line).group(2))
except IOError as err: # pylint: disable=broad-except
- self._log_warn("could not read from %s: %s" % (corosync_conf, err))
+ self._log_warn(f"could not read from {corosync_conf}: {err}")
def postproc(self):
self.do_cmd_output_sub(
diff --git a/sos/report/plugins/crio.py b/sos/report/plugins/crio.py
index 9e7983b4..e5a4ba43 100644
--- a/sos/report/plugins/crio.py
+++ b/sos/report/plugins/crio.py
@@ -65,11 +65,11 @@ class CRIO(Plugin, RedHatPlugin, UbuntuPlugin, CosPlugin):
'version',
]
- self.add_cmd_output(["crictl %s" % s for s in subcmds])
+ self.add_cmd_output([f"crictl {s}" for s in subcmds])
ps_cmd = 'crictl ps --quiet'
if self.get_option('all'):
- ps_cmd = "%s -a" % ps_cmd
+ ps_cmd = f"{ps_cmd} -a"
img_cmd = 'crictl images --quiet'
pod_cmd = 'crictl pods --quiet'
@@ -81,18 +81,18 @@ class CRIO(Plugin, RedHatPlugin, UbuntuPlugin, CosPlugin):
self._get_crio_goroutine_stacks()
for container in containers:
- self.add_cmd_output("crictl inspect %s" % container,
+ self.add_cmd_output(f"crictl inspect {container}",
subdir="containers")
if self.get_option('logs'):
- self.add_cmd_output("crictl logs -t %s" % container,
+ self.add_cmd_output(f"crictl logs -t {container}",
subdir="containers/logs", priority=100,
tags="crictl_logs")
for image in images:
- self.add_cmd_output("crictl inspecti %s" % image, subdir="images")
+ self.add_cmd_output(f"crictl inspecti {image}", subdir="images")
for pod in pods:
- self.add_cmd_output("crictl inspectp %s" % pod, subdir="pods")
+ self.add_cmd_output(f"crictl inspectp {pod}", subdir="pods")
def _get_crio_list(self, cmd):
ret = []
diff --git a/sos/report/plugins/crypto.py b/sos/report/plugins/crypto.py
index 3b6b8407..0350acbf 100644
--- a/sos/report/plugins/crypto.py
+++ b/sos/report/plugins/crypto.py
@@ -23,8 +23,8 @@ class Crypto(Plugin, IndependentPlugin):
cpth = '/etc/crypto-policies/back-ends'
self.add_file_tags({
- "%s/bind.config" % cpth: 'crypto_policies_bind',
- "%s/opensshserver.config" % cpth: 'crypto_policies_opensshserver',
+ f"{cpth}/bind.config": 'crypto_policies_bind',
+ f"{cpth}/opensshserver.config": 'crypto_policies_opensshserver',
'/etc/crypto-policies/.*/current': 'crypto_policies_state_current',
'/etc/crypto-policies/config': 'crypto_policies_config'
})
diff --git a/sos/report/plugins/dellrac.py b/sos/report/plugins/dellrac.py
index 00f92aa0..71e0b00e 100644
--- a/sos/report/plugins/dellrac.py
+++ b/sos/report/plugins/dellrac.py
@@ -27,8 +27,8 @@ class DellRAC(Plugin, IndependentPlugin):
def setup(self):
for subcmd in ['getniccfg', 'getsysinfo']:
self.add_cmd_output(
- '%s %s' % (self.racadm, subcmd),
- suggest_filename='%s_%s' % (self.prefix, subcmd))
+ f'{self.racadm} {subcmd}',
+ suggest_filename=f'{self.prefix}_{subcmd}')
if self.get_option("debug"):
self.do_debug()
@@ -45,7 +45,7 @@ class DellRAC(Plugin, IndependentPlugin):
logpath = self.get_cmd_output_path(make=False)
subcmd = 'supportassist collect -f'
self.add_cmd_output(
- '%s %s support.zip' % (self.racadm, subcmd),
- runat=logpath, suggest_filename='%s_%s' % (self.prefix, subcmd))
+ f'{self.racadm} {subcmd} support.zip',
+ runat=logpath, suggest_filename=f'{self.prefix}_{subcmd}')
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/dlm.py b/sos/report/plugins/dlm.py
index b492c2a4..293766eb 100644
--- a/sos/report/plugins/dlm.py
+++ b/sos/report/plugins/dlm.py
@@ -44,8 +44,8 @@ class Dlm(Plugin, IndependentPlugin):
lock_re = re.compile(lock_exp, re.MULTILINE)
for lockspace in lock_re.findall(result["output"]):
self.add_cmd_output(
- "dlm_tool lockdebug -svw '%s'" % lockspace,
- suggest_filename="dlm_locks_%s" % lockspace
+ f"dlm_tool lockdebug -svw '{lockspace}'",
+ suggest_filename=f"dlm_locks_{lockspace}"
)
# vim: et ts=4 sw=4
diff --git a/sos/report/plugins/dmraid.py b/sos/report/plugins/dmraid.py
index 54fba644..aa7641fe 100644
--- a/sos/report/plugins/dmraid.py
+++ b/sos/report/plugins/dmraid.py
@@ -32,7 +32,7 @@ class Dmraid(Plugin, IndependentPlugin):
def setup(self):
for opt in self.dmraid_options:
- self.add_cmd_output("dmraid -%s" % (opt,))
+ self.add_cmd_output(f"dmraid -{opt}")
if self.get_option("metadata"):
metadata_path = self.get_cmd_output_path("metadata")
self.add_cmd_output("dmraid -rD", runat=metadata_path,
diff --git a/sos/report/plugins/dnf.py b/sos/report/plugins/dnf.py
index 11f7ec66..af75e680 100644
--- a/sos/report/plugins/dnf.py
+++ b/sos/report/plugins/dnf.py
@@ -115,7 +115,7 @@ class DNFPlugin(Plugin, RedHatPlugin):
except ValueError:
pass
for tr_id in range(1, min(transactions+1, 50)):
- self.add_cmd_output("dnf history info %d" % tr_id,
+ self.add_cmd_output(f"dnf history info {tr_id}",
subdir="history-info",
tags='dnf_history_info')
diff --git a/sos/report/plugins/docker.py b/sos/report/plugins/docker.py
index a483b292..366ce92d 100644
--- a/sos/report/plugins/docker.py
+++ b/sos/report/plugins/docker.py
@@ -57,7 +57,7 @@ class Docker(Plugin, CosPlugin):
]
for subcmd in subcmds:
- self.add_cmd_output("docker %s" % subcmd)
+ self.add_cmd_output(f"docker {subcmd}")
self.add_cmd_output("docker info",
tags="docker_info")
@@ -76,7 +76,7 @@ class Docker(Plugin, CosPlugin):
if nets['status'] == 0:
networks = [n.split()[1] for n in nets['output'].splitlines()[1:]]
for net in networks:
- self.add_cmd_output("docker network inspect %s" % net)
+ self.add_cmd_output(f"docker network inspect {net}")
containers = [
c[0] for c in self.get_containers(runtime='docker',
@@ -86,20 +86,20 @@ class Docker(Plugin, CosPlugin):
volumes = self.get_container_volumes(runtime='docker')
for container in containers:
- self.add_cmd_output("docker inspect %s" % container,
+ self.add_cmd_output(f"docker inspect {container}",
subdir='containers')
if self.get_option('logs'):
- self.add_cmd_output("docker logs -t %s" % container,
+ self.add_cmd_output(f"docker logs -t {container}",
subdir='containers')
for img in images:
name, img_id = img
insp = name if 'none' not in name else img_id
- self.add_cmd_output("docker inspect %s" % insp, subdir='images',
+ self.add_cmd_output(f"docker inspect {insp}", subdir='images',
tags="docker_image_inspect")
for vol in volumes:
- self.add_cmd_output("docker volume inspect %s" % vol,
+ self.add_cmd_output(f"docker volume inspect {vol}",
subdir='volumes')
def postproc(self):
diff --git a/sos/report/plugins/ds.py b/sos/report/plugins/ds.py
index b05a0491..4fa7fabb 100644
--- a/sos/report/plugins/ds.py
+++ b/sos/report/plugins/ds.py
@@ -50,8 +50,8 @@ class DirectoryServer(Plugin, RedHatPlugin):
for dsrv in self.listdir("/etc/dirsrv"):
if dsrv[0:5] == 'slapd':
certpath = self.path_join("/etc/dirsrv", dsrv)
- self.add_cmd_output("certutil -L -d %s" % certpath)
- self.add_cmd_output("dsctl %s healthcheck" % dsrv)
+ self.add_cmd_output(f"certutil -L -d {certpath}")
+ self.add_cmd_output(f"dsctl {dsrv} healthcheck")
except OSError:
self._log_warn("could not list /etc/dirsrv")
diff --git a/sos/report/plugins/ebpf.py b/sos/report/plugins/ebpf.py
index 4bd6a657..6c426933 100644
--- a/sos/report/plugins/ebpf.py
+++ b/sos/report/plugins/ebpf.py
@@ -27,7 +27,7 @@ class Ebpf(Plugin, IndependentPlugin):
try:
prog_data = json.loads(prog_json)
except Exception as err: # pylint: disable=broad-except
- self._log_info("Couldn't parse bpftool prog list: %s" % err)
+ self._log_info(f"Couldn't parse bpftool prog list: {err}")
return out
for _, item in enumerate(prog_data):
if "id" in item:
@@ -40,7 +40,7 @@ class Ebpf(Plugin, IndependentPlugin):
try:
map_data = json.loads(map_json)
except Exception as err: # pylint: disable=broad-except
- self._log_info("Could not parse bpftool map list: %s" % err)
+ self._log_info(f"Could not parse bpftool map list: {err}")
return out
for _, item in enumerate(map_data):
if "id" in item:
@@ -52,12 +52,12 @@ class Ebpf(Plugin, IndependentPlugin):
progs = self.collect_cmd_output("bpftool -j prog list")
for prog_id in self.get_bpftool_prog_ids(progs['output']):
for dumpcmd in ["xlated", "jited"]:
- self.add_cmd_output("bpftool prog dump %s id %s" %
- (dumpcmd, prog_id))
+ self.add_cmd_output(f"bpftool prog dump {dumpcmd} id "
+ f"{prog_id}")
maps = self.collect_cmd_output("bpftool -j map list")
for map_id in self.get_bpftool_map_ids(maps['output']):
- self.add_cmd_output("bpftool map dump id %s" % map_id)
+ self.add_cmd_output(f"bpftool map dump id {map_id}")
self.add_cmd_output([
# collect list of eBPF programs and maps and their dumps
diff --git a/sos/report/plugins/elastic.py b/sos/report/plugins/elastic.py
index 1a8803d5..f20a76ea 100644
--- a/sos/report/plugins/elastic.py
+++ b/sos/report/plugins/elastic.py
@@ -36,7 +36,7 @@ class Elastic(Plugin, IndependentPlugin):
if network_port and len(network_port.groups()) == 2:
port = network_port.groups()[-1].strip()
except Exception as err: # pylint: disable=broad-except
- self._log_info("Failed to parse %s: %s" % (els_config_file, err))
+ self._log_info(f"Failed to parse {els_config_file}: {err}")
return hostname, port
def setup(self):
@@ -53,13 +53,13 @@ class Elastic(Plugin, IndependentPlugin):
host, port = self.get_hostname_port(els_config_file)
endpoint = host + ":" + port
self.add_cmd_output([
- "curl -X GET '%s/_cluster/settings?pretty'" % endpoint,
- "curl -X GET '%s/_cluster/health?pretty'" % endpoint,
- "curl -X GET '%s/_cluster/stats?pretty'" % endpoint,
- "curl -X GET '%s/_cat/nodes?v'" % endpoint,
- "curl -X GET '%s/_cat/indices'" % endpoint,
- "curl -X GET '%s/_cat/shards'" % endpoint,
- "curl -X GET '%s/_cat/aliases'" % endpoint,
+ f"curl -X GET '{endpoint}/_cluster/settings?pretty'",
+ f"curl -X GET '{endpoint}/_cluster/health?pretty'",
+ f"curl -X GET '{endpoint}/_cluster/stats?pretty'",
+ f"curl -X GET '{endpoint}/_cat/nodes?v'",
+ f"curl -X GET '{endpoint}/_cat/indices'",
+ f"curl -X GET '{endpoint}/_cat/shards'",
+ f"curl -X GET '{endpoint}/_cat/aliases'",
])
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/fibrechannel.py b/sos/report/plugins/fibrechannel.py
index 535af137..745b8681 100644
--- a/sos/report/plugins/fibrechannel.py
+++ b/sos/report/plugins/fibrechannel.py
@@ -45,8 +45,8 @@ class Fibrechannel(Plugin, RedHatPlugin):
if 'Port WWN' in line:
dev = line.split()[3]
self.add_cmd_output([
- "hbacmd HbaAttributes %s" % dev,
- "hbacmd PortAttributes %s" % dev,
- "hbacmd GetXcvrData %s" % dev
+ f"hbacmd HbaAttributes {dev}",
+ f"hbacmd PortAttributes {dev}",
+ f"hbacmd GetXcvrData {dev}",
])
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/filesys.py b/sos/report/plugins/filesys.py
index 781d03b5..5ab54715 100644
--- a/sos/report/plugins/filesys.py
+++ b/sos/report/plugins/filesys.py
@@ -83,11 +83,11 @@ class Filesys(Plugin, DebianPlugin, UbuntuPlugin, CosPlugin):
mounts = '/proc/mounts'
ext_fs_regex = r"^(/dev/\S+).+ext[234]\s+"
for dev in self.do_regex_find_all(ext_fs_regex, mounts):
- self.add_cmd_output("dumpe2fs %s %s" % (dumpe2fs_opts, dev),
+ self.add_cmd_output(f"dumpe2fs {dumpe2fs_opts} {dev}",
tags="dumpe2fs_h")
if self.get_option('frag'):
- self.add_cmd_output("e2freefrag %s" % (dev), priority=100)
+ self.add_cmd_output(f"e2freefrag {dev}", priority=100)
def postproc(self):
self.do_file_sub(
diff --git a/sos/report/plugins/foreman.py b/sos/report/plugins/foreman.py
index 8ca52741..5ca4439e 100644
--- a/sos/report/plugins/foreman.py
+++ b/sos/report/plugins/foreman.py
@@ -129,8 +129,8 @@ class Foreman(Plugin):
'passenger-memory-stats',
'ls -lanR /root/ssl-build',
'ls -lanR /usr/share/foreman/config/hooks',
- 'ping -c1 -W1 %s' % _hostname,
- 'ping -c1 -W1 %s' % _host_f,
+ f'ping -c1 -W1 {_hostname}',
+ f'ping -c1 -W1 {_host_f}',
'ping -c1 -W1 localhost'
])
self.add_cmd_output(
@@ -183,7 +183,7 @@ class Foreman(Plugin):
def collect_foreman_db(self):
""" Collect foreman db and dynflow data """
- days = '%s days' % self.get_option('days')
+ days = f'{self.get_option("days")} days'
interval = quote(days)
# Construct the DB queries, using the days option to limit the range
@@ -286,7 +286,7 @@ class Foreman(Plugin):
# proxy is now tuple [name, url]
_cmd = 'curl -s --key /etc/foreman/client_key.pem ' \
'--cert /etc/foreman/client_cert.pem ' \
- '%s/v2/features' % proxy[1]
+ f'{proxy[1]}/v2/features'
self.add_cmd_output(_cmd, suggest_filename=proxy[0],
subdir='smart_proxies_features',
timeout=10)
@@ -303,8 +303,8 @@ class Foreman(Plugin):
a large amount of quoting in sos logs referencing the command being run
"""
if csv:
- query = "COPY (%s) TO STDOUT " \
- "WITH (FORMAT 'csv', DELIMITER ',', HEADER)" % query
+ query = f"COPY ({query}) TO STDOUT " \
+ "WITH (FORMAT 'csv', DELIMITER ',', HEADER)"
_dbcmd = "%s --no-password -h %s -p 5432 -U foreman -d foreman -c %s"
return _dbcmd % (binary, self.dbhost, quote(query))
diff --git a/sos/report/plugins/foreman_installer.py b/sos/report/plugins/foreman_installer.py
index d5a7c245..8967538a 100644
--- a/sos/report/plugins/foreman_installer.py
+++ b/sos/report/plugins/foreman_installer.py
@@ -69,14 +69,14 @@ class ForemanInstaller(Plugin, DebianPlugin, UbuntuPlugin):
# all scrubbing applied to configs must be applied to installer logs
# as well, since logs contain diff of configs
self.do_path_regex_sub(
- r"(/etc/foreman-(installer|maintain)/(.*)((conf)(.*)?))|(%s)"
- % install_logs,
+ r"(/etc/foreman-(installer|maintain)/(.*)((conf)(.*)?))|"
+ fr"({install_logs})",
r"((\:|\s*)(passw|cred|token|secret|key).*(\:\s|=))(.*)",
r"\1********")
# yaml values should be alphanumeric
self.do_path_regex_sub(
- r"(/etc/foreman-(installer|maintain)/(.*)((yaml|yml)(.*)?))|(%s)"
- % install_logs,
+ r"(/etc/foreman-(installer|maintain)/(.*)((yaml|yml)(.*)?))|"
+ fr"({install_logs})",
r"((\:|\s*)(passw|cred|token|secret|key).*(\:\s|=))(.*)",
r'\1"********"')
diff --git a/sos/report/plugins/gluster.py b/sos/report/plugins/gluster.py
index 58c3ea13..404143cd 100644
--- a/sos/report/plugins/gluster.py
+++ b/sos/report/plugins/gluster.py
@@ -118,16 +118,16 @@ class Gluster(Plugin, RedHatPlugin):
continue
volname = line[12:]
self.add_cmd_output([
- "gluster volume get %s all" % volname,
- "gluster volume geo-replication %s status" % volname,
- "gluster volume heal %s info" % volname,
- "gluster volume heal %s info split-brain" % volname,
- "gluster volume status %s clients" % volname,
- "gluster snapshot list %s" % volname,
- "gluster volume quota %s list" % volname,
- "gluster volume rebalance %s status" % volname,
- "gluster snapshot info %s" % volname,
- "gluster snapshot status %s" % volname
+ f"gluster volume get {volname} all",
+ f"gluster volume geo-replication {volname} status",
+ f"gluster volume heal {volname} info",
+ f"gluster volume heal {volname} info split-brain",
+ f"gluster volume status {volname} clients",
+ f"gluster snapshot list {volname}",
+ f"gluster volume quota {volname} list",
+ f"gluster volume rebalance {volname} status",
+ f"gluster snapshot info {volname}",
+ f"gluster snapshot status {volname}",
])
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/grafana.py b/sos/report/plugins/grafana.py
index 4343ecd6..33d0b558 100644
--- a/sos/report/plugins/grafana.py
+++ b/sos/report/plugins/grafana.py
@@ -67,5 +67,5 @@ class Grafana(Plugin, IndependentPlugin):
else "/etc/grafana/grafana.ini"
)
- regexp = r"(^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys)
+ regexp = fr"(^\s*({'|'.join(protect_keys)})\s*=\s*)(.*)"
self.do_path_regex_sub(inifile, regexp, r"\1*********")
diff --git a/sos/report/plugins/grub2.py b/sos/report/plugins/grub2.py
index 1c500d12..e4d60e4d 100644
--- a/sos/report/plugins/grub2.py
+++ b/sos/report/plugins/grub2.py
@@ -46,7 +46,7 @@ class Grub2(Plugin, IndependentPlugin):
# to prevent removing of extra args in $kernel_opts, and (only) if so,
# call the command with this argument
grub_cmd = 'grub2-mkconfig'
- out = {'cmd': '%s --help' % grub_cmd, 'output': '--no-grubenv-update'}
+ out = {'cmd': f'{grub_cmd} --help', 'output': '--no-grubenv-update'}
if self.test_predicate(self, pred=SoSPredicate(self, cmd_outputs=out)):
grub_cmd += ' --no-grubenv-update'
self.add_cmd_output(grub_cmd, env={'GRUB_DISABLE_OS_PROBER': 'true'},
diff --git a/sos/report/plugins/hpssm.py b/sos/report/plugins/hpssm.py
index b59770c6..f1991124 100644
--- a/sos/report/plugins/hpssm.py
+++ b/sos/report/plugins/hpssm.py
@@ -42,7 +42,7 @@ class Hpssm(Plugin, IndependentPlugin):
'show detail'
]
self.add_cmd_output(
- ["%s %s" % (cmd, subcmd) for subcmd in subcmds]
+ [f"{cmd} {subcmd}" for subcmd in subcmds]
)
pattern = re.compile("^HP[E] (.*) in Slot ([0123456789]+)")
@@ -55,11 +55,7 @@ class Hpssm(Plugin, IndependentPlugin):
for m in [pattern.search(line)] if m]
ssacli_ctrl_slot_cmd = cmd + ' ctrl slot='
self.add_cmd_output(
- ["%s%s %s" % (
- ssacli_ctrl_slot_cmd,
- slot,
- slot_subcmd
- )
+ [f"{ssacli_ctrl_slot_cmd}{slot} {slot_subcmd}"
for slot in ctrl_slots
for slot_subcmd in slot_subcmds]
)
@@ -67,7 +63,7 @@ class Hpssm(Plugin, IndependentPlugin):
logpath = self.get_cmd_output_path()
self.add_cmd_output(
- 'ssaducli -v -adu -f %s/adu-log.zip' % logpath,
+ f'ssaducli -v -adu -f {logpath}/adu-log.zip',
suggest_filename='ssaducli_-v_-adu.log'
)
@@ -77,7 +73,7 @@ class Hpssm(Plugin, IndependentPlugin):
def do_debug(self, logpath):
""" Collect debug logs """
self.add_cmd_output(
- 'ilorest serverlogs --selectlog=AHS --directorypath=%s' % logpath,
+ f'ilorest serverlogs --selectlog=AHS --directorypath={logpath}',
runat=logpath, suggest_filename='ilorest.log'
)
diff --git a/sos/report/plugins/infiniband.py b/sos/report/plugins/infiniband.py
index a5aae196..cf1cb82f 100644
--- a/sos/report/plugins/infiniband.py
+++ b/sos/report/plugins/infiniband.py
@@ -72,7 +72,7 @@ class Infiniband(Plugin, IndependentPlugin):
except IOError:
continue
- opts = "-C %s -P %s" % (ibdev, port)
- self.add_cmd_output(["%s %s" % (c, opts) for c in ports_cmds])
+ opts = f"-C {ibdev} -P {port}"
+ self.add_cmd_output([f"{c} {opts}" for c in ports_cmds])
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/ipa.py b/sos/report/plugins/ipa.py
index c6a76a48..5a5dfc88 100644
--- a/sos/report/plugins/ipa.py
+++ b/sos/report/plugins/ipa.py
@@ -95,7 +95,7 @@ class Ipa(Plugin, RedHatPlugin):
if self.ipa_server_installed():
self._log_debug("IPA server install detected")
- self._log_debug("IPA version is [%s]" % ipa_version)
+ self._log_debug(f"IPA version is [{ipa_version}]")
self.add_copy_spec([
"/var/log/ipaserver-install.log",
@@ -145,8 +145,8 @@ class Ipa(Plugin, RedHatPlugin):
pki_tomcat_dir = self.pki_tomcat_dir_v3
pki_tomcat_conf_dir = self.pki_tomcat_conf_dir_v3
- self.add_cmd_output("certutil -L -d %s/alias" % pki_tomcat_dir)
- self.add_copy_spec("%s/CS.cfg" % pki_tomcat_conf_dir)
+ self.add_cmd_output(f"certutil -L -d {pki_tomcat_dir}/alias")
+ self.add_copy_spec(f"{pki_tomcat_conf_dir}/CS.cfg")
self.add_forbidden_path([
"/etc/pki/nssdb/key*",
@@ -158,9 +158,9 @@ class Ipa(Plugin, RedHatPlugin):
"/etc/httpd/alias/pin.txt",
"/etc/httpd/alias/pwdfile.txt",
"/etc/named.keytab",
- "%s/alias/key*" % pki_tomcat_dir,
- "%s/flatfile.txt" % pki_tomcat_conf_dir,
- "%s/password.conf" % pki_tomcat_conf_dir,
+ f"{pki_tomcat_dir}/alias/key*",
+ f"{pki_tomcat_conf_dir}/flatfile.txt",
+ f"{pki_tomcat_conf_dir}/password.conf",
])
self.add_cmd_output([
@@ -180,7 +180,7 @@ class Ipa(Plugin, RedHatPlugin):
tags="getcert_list")
for certdb_directory in glob("/etc/dirsrv/slapd-*/"):
- self.add_cmd_output("certutil -L -d %s" % certdb_directory)
+ self.add_cmd_output(f"certutil -L -d {certdb_directory}")
self.add_file_tags({
"/var/log/ipa/healthcheck/healthcheck.log":
diff --git a/sos/report/plugins/ipmitool.py b/sos/report/plugins/ipmitool.py
index 8811f07c..5f588060 100644
--- a/sos/report/plugins/ipmitool.py
+++ b/sos/report/plugins/ipmitool.py
@@ -28,23 +28,23 @@ class IpmiTool(Plugin, RedHatPlugin, DebianPlugin):
for subcmd in ['channel info', 'channel getaccess', 'lan print']:
for channel in [1, 3]:
- self.add_cmd_output("%s %s %d" % (cmd, subcmd, channel))
+ self.add_cmd_output(f"{cmd} {subcmd} {channel}")
# raw 0x30 0x65: Get HDD drive Fault LED State
# raw 0x30 0xb0: Get LED Status
self.add_cmd_output([
- "%s raw 0x30 0x65" % cmd,
- "%s raw 0x30 0xb0" % cmd,
- "%s sel info" % cmd,
- "%s sel elist" % cmd,
- "%s sel list -v" % cmd,
- "%s sensor list" % cmd,
- "%s chassis status" % cmd,
- "%s lan print" % cmd,
- "%s fru print" % cmd,
- "%s mc info" % cmd,
- "%s sdr info" % cmd
+ f"{cmd} raw 0x30 0x65",
+ f"{cmd} raw 0x30 0xb0",
+ f"{cmd} sel info",
+ f"{cmd} sel elist",
+ f"{cmd} sel list -v",
+ f"{cmd} sensor list",
+ f"{cmd} chassis status",
+ f"{cmd} lan print",
+ f"{cmd} fru print",
+ f"{cmd} mc info",
+ f"{cmd} sdr info",
])
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/iprconfig.py b/sos/report/plugins/iprconfig.py
index 126b8ddb..1060e5ab 100644
--- a/sos/report/plugins/iprconfig.py
+++ b/sos/report/plugins/iprconfig.py
@@ -52,9 +52,9 @@ class IprConfig(Plugin, IndependentPlugin):
devices.append(temp[0])
for device in devices:
- self.add_cmd_output("iprconfig -c show-details %s" % device)
- self.add_cmd_output("iprconfig -c show-battery-info %s" % device)
- self.add_cmd_output("iprconfig -c show-perf %s" % device)
+ self.add_cmd_output(f"iprconfig -c show-details {device}")
+ self.add_cmd_output(f"iprconfig -c show-battery-info {device}")
+ self.add_cmd_output(f"iprconfig -c show-perf {device}")
# Look for IBM Power RAID enclosures (iprconfig lists them)
show_config = self.collect_cmd_output("iprconfig -c show-config")
@@ -105,6 +105,6 @@ class IprConfig(Plugin, IndependentPlugin):
temp = alt_line.split(' ')
# temp[0] holds device name
self.add_cmd_output("iprconfig -c "
- "query-ses-mode %s" % temp[0])
+ f"query-ses-mode {temp[0]}")
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/juju.py b/sos/report/plugins/juju.py
index b0208042..468aa843 100644
--- a/sos/report/plugins/juju.py
+++ b/sos/report/plugins/juju.py
@@ -63,7 +63,7 @@ class Juju(Plugin, UbuntuPlugin):
]
# Redact simple yaml style "key: value".
- keys_regex = r"(^\s*(%s)\s*:\s*)(.*)" % "|".join(protect_keys)
+ keys_regex = fr"(^\s*({'|'.join(protect_keys)})\s*:\s*)(.*)"
sub_regex = r"\1*********"
self.do_path_regex_sub(agents_path, keys_regex, sub_regex)
# Redact certificates
diff --git a/sos/report/plugins/kdump.py b/sos/report/plugins/kdump.py
index 94401256..9ad71a5e 100644
--- a/sos/report/plugins/kdump.py
+++ b/sos/report/plugins/kdump.py
@@ -72,7 +72,7 @@ class RedHatKDump(KDump, RedHatPlugin):
initramfs_img = "/boot/initramfs-" + platform.release() \
+ "kdump.img"
if self.path_exists(initramfs_img):
- self.add_cmd_output("lsinitrd %s" % initramfs_img)
+ self.add_cmd_output(f"lsinitrd {initramfs_img}")
self.add_copy_spec([
"/etc/kdump.conf",
@@ -102,7 +102,7 @@ class DebianKDump(KDump, DebianPlugin, UbuntuPlugin):
initramfs_img = "/var/lib/kdump/initrd.img-" + platform.release()
if self.path_exists(initramfs_img):
- self.add_cmd_output("lsinitramfs -l %s" % initramfs_img)
+ self.add_cmd_output(f"lsinitramfs -l {initramfs_img}")
self.add_cmd_output("kdump-config show")
diff --git a/sos/report/plugins/kernel.py b/sos/report/plugins/kernel.py
index 1503af2b..abfde7c9 100644
--- a/sos/report/plugins/kernel.py
+++ b/sos/report/plugins/kernel.py
@@ -59,7 +59,7 @@ class Kernel(Plugin, IndependentPlugin):
suggest_filename="modinfo_ALL_MODULES",
tags='modinfo_all')
except OSError:
- self._log_warn("could not list %s" % self.sys_module)
+ self._log_warn(f"could not list {self.sys_module}")
# find /lib/modules/*/{extras,updates,weak-updates} -ls
extra_mod_patterns = [
@@ -72,7 +72,7 @@ class Kernel(Plugin, IndependentPlugin):
extra_mod_paths.extend(glob.glob(pattern))
if extra_mod_paths:
- self.add_cmd_output("find %s -ls" % " ".join(extra_mod_paths))
+ self.add_cmd_output(f"find {' '.join(extra_mod_paths)} -ls")
self.add_cmd_output([
"dmesg",
diff --git a/sos/report/plugins/kubernetes.py b/sos/report/plugins/kubernetes.py
index 41c7ddeb..eb3e3747 100644
--- a/sos/report/plugins/kubernetes.py
+++ b/sos/report/plugins/kubernetes.py
@@ -163,7 +163,7 @@ class Kubernetes(Plugin):
knsps = [n.split()[0] for n in kn_output if n and len(n.split())]
for nspace in knsps:
- knsp = '--namespace=%s' % nspace
+ knsp = f'--namespace={nspace}'
if self.get_option('all'):
k_cmd = f'{self.kube_cmd} get -o json {knsp}'
diff --git a/sos/report/plugins/landscape.py b/sos/report/plugins/landscape.py
index cd401e64..fe074afa 100644
--- a/sos/report/plugins/landscape.py
+++ b/sos/report/plugins/landscape.py
@@ -88,7 +88,7 @@ class Landscape(Plugin, UbuntuPlugin):
]
self.do_path_regex_sub(
"/etc/landscape/service.conf*",
- r"(%s) = (.*)" % "|".join(keys),
+ fr"({'|'.join(keys)}) = (.*)",
r"\1 = [********]"
)
diff --git a/sos/report/plugins/libraries.py b/sos/report/plugins/libraries.py
index 015b3777..3a551a2d 100644
--- a/sos/report/plugins/libraries.py
+++ b/sos/report/plugins/libraries.py
@@ -44,7 +44,7 @@ class Libraries(Plugin, IndependentPlugin):
dirs.add(fqlib[1].rsplit('/', 1)[0])
if dirs:
- self.add_cmd_output("ls -lanH %s" % " ".join(dirs),
+ self.add_cmd_output(f"ls -lanH {' '.join(dirs)}",
suggest_filename="ld_so_cache")
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/libvirt.py b/sos/report/plugins/libvirt.py
index cec249ad..25d718a4 100644
--- a/sos/report/plugins/libvirt.py
+++ b/sos/report/plugins/libvirt.py
@@ -72,7 +72,7 @@ class Libvirt(Plugin, IndependentPlugin):
])
if self.path_exists(self.path_join(libvirt_keytab)):
- self.add_cmd_output("klist -ket %s" % libvirt_keytab)
+ self.add_cmd_output(f"klist -ket {libvirt_keytab}")
self.add_cmd_output("ls -lR /var/lib/libvirt/qemu")
@@ -82,7 +82,7 @@ class Libvirt(Plugin, IndependentPlugin):
pid = pfile.read().splitlines()[0]
pr_files = ["environ", "cgroup", "maps", "numa_maps", "limits"]
for file in pr_files:
- self.add_copy_spec("/proc/%s/%s" % (pid, file))
+ self.add_copy_spec(f"/proc/{pid}/{file}")
self.add_file_tags({
"/run/libvirt/qemu/*.xml": "var_qemu_xml",
diff --git a/sos/report/plugins/logs.py b/sos/report/plugins/logs.py
index 7487efdb..04c14529 100644
--- a/sos/report/plugins/logs.py
+++ b/sos/report/plugins/logs.py
@@ -132,6 +132,6 @@ class CosLogs(LogsBase, CosPlugin):
self.add_cmd_output("journalctl -o export")
else:
days = self.get_option("log_days", 3)
- self.add_journal(since="-%ddays" % days)
+ self.add_journal(since=f"-{days}days")
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/lstopo.py b/sos/report/plugins/lstopo.py
index e7148c82..758c32aa 100644
--- a/sos/report/plugins/lstopo.py
+++ b/sos/report/plugins/lstopo.py
@@ -30,7 +30,7 @@ class Lstopo(Plugin, IndependentPlugin):
cmd = "lstopo"
else:
cmd = "lstopo-no-graphics"
- self.add_cmd_output("%s --whole-io --of console" % cmd,
+ self.add_cmd_output(f"{cmd} --whole-io --of console",
suggest_filename="lstopo.txt")
- self.add_cmd_output("%s --whole-io --of xml" % cmd,
+ self.add_cmd_output(f"{cmd} --whole-io --of xml",
suggest_filename="lstopo.xml")
diff --git a/sos/report/plugins/lustre.py b/sos/report/plugins/lustre.py
index d3ad0139..4f08b4ae 100644
--- a/sos/report/plugins/lustre.py
+++ b/sos/report/plugins/lustre.py
@@ -23,8 +23,8 @@ class Lustre(Plugin, RedHatPlugin):
file.
"""
- self.add_cmd_output("lctl get_param %s" % " ".join(param_list),
- suggest_filename="params-%s" % name,
+ self.add_cmd_output(f"lctl get_param {' '.join(param_list)}",
+ suggest_filename=f"params-{name}",
stderr=False)
def setup(self):
diff --git a/sos/report/plugins/lvm2.py b/sos/report/plugins/lvm2.py
index ef907af1..fabafe71 100644
--- a/sos/report/plugins/lvm2.py
+++ b/sos/report/plugins/lvm2.py
@@ -82,7 +82,7 @@ class Lvm2(Plugin, IndependentPlugin):
lvm_opts_foreign = lvm_opts + ' --foreign'
self.add_cmd_output(
- "vgdisplay -vv %s" % lvm_opts_foreign,
+ f"vgdisplay -vv {lvm_opts_foreign}",
root_symlink="vgdisplay", tags="vgdisplay"
)
@@ -92,16 +92,16 @@ class Lvm2(Plugin, IndependentPlugin):
vgs_cols = vgs_cols + ',' + 'vg_tags,systemid'
lvs_cols = ('lv_tags,devices,lv_kernel_read_ahead,lv_read_ahead,'
'stripes,stripesize')
- self.add_cmd_output("lvs -a -o +%s %s" % (lvs_cols, lvm_opts_foreign),
+ self.add_cmd_output(f"lvs -a -o +{lvs_cols} {lvm_opts_foreign}",
tags="lvs_headings")
self.add_cmd_output(
- "pvs -a -v -o +%s %s" % (pvs_cols, lvm_opts_foreign),
+ f"pvs -a -v -o +{pvs_cols} {lvm_opts_foreign}",
tags="pvs_headings")
- self.add_cmd_output("vgs -v -o +%s %s" % (vgs_cols, lvm_opts_foreign),
+ self.add_cmd_output(f"vgs -v -o +{vgs_cols} {lvm_opts_foreign}",
tags="vgs_headings")
self.add_cmd_output([
- "pvscan -v %s" % lvm_opts,
- "vgscan -vvv %s" % lvm_opts
+ f"pvscan -v {lvm_opts}",
+ f"vgscan -vvv {lvm_opts}",
])
self.add_copy_spec("/etc/lvm")
diff --git a/sos/report/plugins/maas.py b/sos/report/plugins/maas.py
index 1718f7b9..92dbe379 100644
--- a/sos/report/plugins/maas.py
+++ b/sos/report/plugins/maas.py
@@ -55,11 +55,8 @@ class Maas(Plugin, UbuntuPlugin):
def _remote_api_login(self):
ret = self.exec_cmd(
- "maas login %s %s %s" % (
- self.get_option("profile-name"),
- self.get_option("url"),
- self.get_option("credentials")
- )
+ f"maas login {self.get_option('profile-name')} "
+ f"{self.get_option('url')} {self.get_option('credentials')}"
)
return ret['status'] == 0
@@ -125,8 +122,8 @@ class Maas(Plugin, UbuntuPlugin):
if self._has_login_options():
if self._remote_api_login():
- self.add_cmd_output("maas %s commissioning-results list" %
- self.get_option("profile-name"))
+ self.add_cmd_output(f"maas {self.get_option('profile-name')} "
+ "commissioning-results list")
else:
self._log_error(
"Cannot login into MAAS remote API with provided creds.")
diff --git a/sos/report/plugins/md.py b/sos/report/plugins/md.py
index a9b3d0e5..d49d8d96 100644
--- a/sos/report/plugins/md.py
+++ b/sos/report/plugins/md.py
@@ -23,7 +23,7 @@ class Md(Plugin, IndependentPlugin):
for line in mdadm_members['output'].splitlines():
if 'linux_raid_member' in line:
dev = line.split()[0]
- self.add_cmd_output('mdadm -E /dev/%s' % dev,
+ self.add_cmd_output(f'mdadm -E /dev/{dev}',
tags="mdadm_E")
self.add_copy_spec([
diff --git a/sos/report/plugins/megacli.py b/sos/report/plugins/megacli.py
index 1bdd9fd7..6188da59 100644
--- a/sos/report/plugins/megacli.py
+++ b/sos/report/plugins/megacli.py
@@ -30,7 +30,7 @@ class MegaCLI(Plugin, RedHatPlugin):
]
self.add_cmd_output([
- "%s %s -aALL" % (cmd, subcmd) for subcmd in subcmds
+ f"{cmd} {subcmd} -aALL" for subcmd in subcmds
])
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/microshift.py b/sos/report/plugins/microshift.py
index a6605e84..f8a6823e 100644
--- a/sos/report/plugins/microshift.py
+++ b/sos/report/plugins/microshift.py
@@ -56,7 +56,7 @@ class Microshift(Plugin, RedHatPlugin):
if self.get_option('add-namespaces'):
for nsp in self.get_option('add-namespaces').split(':'):
- collect_regexes.append(r'^%s$' % nsp)
+ collect_regexes.append(fr'^{nsp}$')
return collect_regexes
@@ -89,7 +89,7 @@ class Microshift(Plugin, RedHatPlugin):
'oc get namespaces'
' -o custom-columns=NAME:.metadata.name'
' --no-headers'
- ' --kubeconfig=%s' % self.get_option('kubeconfig'))
+ f' --kubeconfig={self.get_option("kubeconfig")}')
if res['status'] == 0:
return self._reduce_namespace_list(res['output'].split('\n'))
return []
@@ -130,8 +130,8 @@ class Microshift(Plugin, RedHatPlugin):
for resource in global_resources:
res = self.exec_cmd(
- "oc get --kubeconfig %s %s" % (
- self.get_option('kubeconfig'), resource),
+ f"oc get --kubeconfig {self.get_option('kubeconfig')} "
+ f"{resource}",
timeout=Microshift.plugin_timeout)
if res['status'] == 0:
_filtered_resources.append(resource)
@@ -163,18 +163,18 @@ class Microshift(Plugin, RedHatPlugin):
_cluster_resources_to_collect = ",".join(
self._get_cluster_resources())
_namespaces_to_collect = " ".join(
- ['ns/%s' % n for n in self._get_namespaces()])
+ [f'ns/{n}' for n in self._get_namespaces()])
if self.is_service_running(Microshift.plugin_name):
_subdir = self.get_cmd_output_path(make=False)
_kubeconfig = self.get_option('kubeconfig')
self.add_cmd_output(
- 'oc adm inspect --kubeconfig %s --dest-dir %s %s' % (
- _kubeconfig, _subdir, _cluster_resources_to_collect),
+ f'oc adm inspect --kubeconfig {_kubeconfig} --dest-dir '
+ f'{_subdir} {_cluster_resources_to_collect}',
suggest_filename='inspect_cluster_resources.log',
timeout=Microshift.plugin_timeout)
self.add_cmd_output(
- 'oc adm inspect --kubeconfig %s --dest-dir %s %s' % (
- _kubeconfig, _subdir, _namespaces_to_collect),
+ f'oc adm inspect --kubeconfig {_kubeconfig} --dest-dir '
+ f'{_subdir} {_namespaces_to_collect}',
suggest_filename='inspect_namespaces.log',
timeout=Microshift.plugin_timeout)
diff --git a/sos/report/plugins/mssql.py b/sos/report/plugins/mssql.py
index 58f5aef5..33582b91 100644
--- a/sos/report/plugins/mssql.py
+++ b/sos/report/plugins/mssql.py
@@ -58,17 +58,16 @@ class MsSQL(Plugin, RedHatPlugin):
(section == '[network]'):
kerberoskeytabfile = words[1].strip()
except IOError as ex:
- self._log_error('Could not open conf file %s: %s' %
- (mssql_conf, ex))
+ self._log_error(f'Could not open conf file {mssql_conf}: {ex}')
return
# Collect AD authentication configuratoin
keytab_err = ('keytab file is specfieid in mssql_conf'
- ' but not found in %s' % kerberoskeytabfile)
+ f' but not found in {kerberoskeytabfile}')
if kerberoskeytabfile is not None:
if self.path_isfile(kerberoskeytabfile):
- self.add_cmd_output('ls -l %s' % kerberoskeytabfile)
- self.add_cmd_output('klist -e -k %s' % kerberoskeytabfile)
+ self.add_cmd_output(f'ls -l {kerberoskeytabfile}')
+ self.add_cmd_output(f'klist -e -k {kerberoskeytabfile}')
else:
self._log_error(keytab_err)
diff --git a/sos/report/plugins/mvcli.py b/sos/report/plugins/mvcli.py
index f5d1feee..d26c43b6 100644
--- a/sos/report/plugins/mvcli.py
+++ b/sos/report/plugins/mvcli.py
@@ -30,6 +30,6 @@ class MvCLI(Plugin, IndependentPlugin):
'smart -p 0',
]
- self.add_cmd_output(["/opt/marvell/bin/mvcli %s" % s for s in subcmds])
+ self.add_cmd_output([f"/opt/marvell/bin/mvcli {s}" for s in subcmds])
# vim: et ts=4 sw=4
diff --git a/sos/report/plugins/mysql.py b/sos/report/plugins/mysql.py
index ac30d16b..66c07167 100644
--- a/sos/report/plugins/mysql.py
+++ b/sos/report/plugins/mysql.py
@@ -56,7 +56,7 @@ class Mysql(Plugin):
if self.get_option("dbdump"):
msg = "database user name and password must be supplied"
- dbdump_err = "mysql.dbdump: %s" % msg
+ dbdump_err = f"mysql.dbdump: {msg}"
dbuser = self.get_option("dbuser")
dbpass = self.get_option("dbpass")
@@ -78,9 +78,9 @@ class Mysql(Plugin):
# the mysql plugin.
os.environ['MYSQL_PWD'] = dbpass
- opts = "--user=%s --all-databases" % dbuser
+ opts = f"--user={dbuser} --all-databases"
name = "mysqldump_--all-databases"
- self.add_cmd_output("mysqldump %s" % opts, suggest_filename=name)
+ self.add_cmd_output(f"mysqldump {opts}", suggest_filename=name)
self.add_cmd_output("du -s /var/lib/mysql/*")
diff --git a/sos/report/plugins/navicli.py b/sos/report/plugins/navicli.py
index 16ceaf70..c95945a6 100644
--- a/sos/report/plugins/navicli.py
+++ b/sos/report/plugins/navicli.py
@@ -43,20 +43,20 @@ class Navicli(Plugin, RedHatPlugin):
information - CLARiiON - commands
"""
self.add_cmd_output([
- "navicli -h %s getall" % sp_address,
- "navicli -h %s getsptime -spa" % sp_address,
- "navicli -h %s getsptime -spb" % sp_address,
- "navicli -h %s getlog" % sp_address,
- "navicli -h %s getdisk" % sp_address,
- "navicli -h %s getcache" % sp_address,
- "navicli -h %s getlun" % sp_address,
- "navicli -h %s getlun -rg -type -default -owner -crus "
- "-capacity" % sp_address,
- "navicli -h %s lunmapinfo" % sp_address,
- "navicli -h %s getcrus" % sp_address,
- "navicli -h %s port -list -all" % sp_address,
- "navicli -h %s storagegroup -list" % sp_address,
- "navicli -h %s spportspeed -get" % sp_address
+ f"navicli -h {sp_address} getall",
+ f"navicli -h {sp_address} getsptime -spa",
+ f"navicli -h {sp_address} getsptime -spb",
+ f"navicli -h {sp_address} getlog",
+ f"navicli -h {sp_address} getdisk",
+ f"navicli -h {sp_address} getcache",
+ f"navicli -h {sp_address} getlun",
+ f"navicli -h {sp_address} getlun -rg -type -default -owner -crus "
+ "-capacity",
+ f"navicli -h {sp_address} lunmapinfo",
+ f"navicli -h {sp_address} getcrus",
+ f"navicli -h {sp_address} port -list -all",
+ f"navicli -h {sp_address} storagegroup -list",
+ f"navicli -h {sp_address} spportspeed -get",
])
def setup(self):
diff --git a/sos/report/plugins/networking.py b/sos/report/plugins/networking.py
index e0b3b962..9257dace 100644
--- a/sos/report/plugins/networking.py
+++ b/sos/report/plugins/networking.py
@@ -20,7 +20,7 @@ class Networking(Plugin):
option_list = [
PluginOpt("traceroute", default=False,
- desc="collect a traceroute to %s" % trace_host),
+ desc=f"collect a traceroute to {trace_host}"),
PluginOpt("namespace_pattern", default="", val_type=str,
desc=("Specific namespace names or patterns to collect, "
"whitespace delimited.")),
@@ -86,13 +86,13 @@ class Networking(Plugin):
tags=['ip_route', 'iproute_show_table_all'])
self.add_cmd_output("plotnetcfg")
- self.add_cmd_output("netstat %s -neopa" % self.ns_wide,
+ self.add_cmd_output(f"netstat {self.ns_wide} -neopa",
root_symlink="netstat")
self.add_cmd_output([
"nstat -zas",
"netstat -s",
- "netstat %s -agn" % self.ns_wide,
+ f"netstat {self.ns_wide} -agn",
"networkctl status -a",
"ip -6 route show table all",
"ip -d route show cache",
@@ -122,8 +122,7 @@ class Networking(Plugin):
if devlinks['status'] == 0:
devlinks_list = devlinks['output'].splitlines()
for devlink in devlinks_list:
- self.add_cmd_output("devlink dev eswitch show %s" %
- devlink)
+ self.add_cmd_output(f"devlink dev eswitch show {devlink}")
# below commands require some kernel module(s) to be loaded
# run them only if the modules are loaded, or if explicitly requested
@@ -139,7 +138,7 @@ class Networking(Plugin):
""" Command tags for ip/ethtool/netstat """
for opt in self.ethtool_shortopts:
self.add_cmd_tags({
- 'ethtool -%s .*' % opt: 'ethool_%s' % opt
+ f'ethtool -{opt} .*': f'ethool_{opt}'
})
self.add_cmd_tags({
@@ -172,7 +171,7 @@ class Networking(Plugin):
# Get ethtool output for every device that does not exist in a
# namespace.
- _ecmds = ["ethtool -%s" % opt for opt in self.ethtool_shortopts]
+ _ecmds = [f"ethtool -{opt}" for opt in self.ethtool_shortopts]
self.add_device_cmd([
_cmd + " %(dev)s" for _cmd in _ecmds
], devices='ethernet')
@@ -196,7 +195,7 @@ class Networking(Plugin):
self.add_device_cmd(cmd, devices="ethernet")
if self.get_option("traceroute"):
- self.add_cmd_output("/bin/traceroute -n %s" % self.trace_host,
+ self.add_cmd_output(f"/bin/traceroute -n {self.trace_host}",
priority=100)
# Capture additional data from namespaces; each command is run
@@ -223,7 +222,7 @@ class Networking(Plugin):
for namespace in namespaces:
_devs = self.devices['namespaced_network'][namespace]
- _subdir = "namespaces/%s" % namespace
+ _subdir = f"namespaces/{namespace}"
ns_cmd_prefix = cmd_prefix + namespace + " "
self.add_cmd_output([
ns_cmd_prefix + "ip -d address show",
@@ -233,9 +232,9 @@ class Networking(Plugin):
ns_cmd_prefix + "ip -6 rule list",
ns_cmd_prefix + "ip vrf show",
ns_cmd_prefix + "sysctl -a",
- ns_cmd_prefix + "netstat %s -neopa" % self.ns_wide,
+ ns_cmd_prefix + f"netstat {self.ns_wide} -neopa",
ns_cmd_prefix + "netstat -s",
- ns_cmd_prefix + "netstat %s -agn" % self.ns_wide,
+ ns_cmd_prefix + f"netstat {self.ns_wide} -agn",
ns_cmd_prefix + "nstat -zas",
], priority=50, subdir=_subdir)
self.add_cmd_output([ns_cmd_prefix + "iptables-save"],
diff --git a/sos/report/plugins/networkmanager.py b/sos/report/plugins/networkmanager.py
index 7773e19c..b9b1b83e 100644
--- a/sos/report/plugins/networkmanager.py
+++ b/sos/report/plugins/networkmanager.py
@@ -98,8 +98,7 @@ class NetworkManager(Plugin, RedHatPlugin, UbuntuPlugin):
#
# Reverse the normal sos quoting convention here and place
# double quotes around the innermost quoted string.
- self.add_cmd_output('%s "%s"' %
- (nmcli_con_details_cmd, con))
+ self.add_cmd_output(f'{nmcli_con_details_cmd} "{con}"')
self.add_device_cmd(
nmcli_dev_details_cmd + ' "%(dev)s"',
diff --git a/sos/report/plugins/ntp.py b/sos/report/plugins/ntp.py
index 8ffa7ecc..c38a8001 100644
--- a/sos/report/plugins/ntp.py
+++ b/sos/report/plugins/ntp.py
@@ -33,7 +33,7 @@ class Ntp(Plugin):
ids = self.collect_cmd_output('ntpq -c as')
if ids['status'] == 0:
for asid in [i.split()[1] for i in ids['output'].splitlines()[3:]]:
- self.add_cmd_output("ntpq -c 'rv %s'" % asid)
+ self.add_cmd_output(f"ntpq -c 'rv {asid}'")
class RedHatNtp(Ntp, RedHatPlugin):
diff --git a/sos/report/plugins/nvidia.py b/sos/report/plugins/nvidia.py
index f9110f3d..25d35e53 100644
--- a/sos/report/plugins/nvidia.py
+++ b/sos/report/plugins/nvidia.py
@@ -31,16 +31,16 @@ class Nvidia(Plugin, IndependentPlugin):
]
self.add_service_status("nvidia-persistenced")
- self.add_cmd_output(["nvidia-smi %s" % cmd for cmd in subcmds])
+ self.add_cmd_output([f"nvidia-smi {cmd}" for cmd in subcmds])
query = ('gpu_name,gpu_bus_id,vbios_version,temperature.gpu,'
'utilization.gpu,memory.total,memory.free,memory.used,'
'clocks.applications.graphics,clocks.applications.memory')
querypages = ('timestamp,gpu_bus_id,gpu_serial,gpu_uuid,'
'retired_pages.address,retired_pages.cause')
- self.add_cmd_output("nvidia-smi --query-gpu=%s --format=csv" % query)
+ self.add_cmd_output(f"nvidia-smi --query-gpu={query} --format=csv")
self.add_cmd_output(
- "nvidia-smi --query-retired-pages=%s --format=csv" % querypages
+ f"nvidia-smi --query-retired-pages={querypages} --format=csv"
)
self.add_journal(boot=0, identifier='nvidia-persistenced')
diff --git a/sos/report/plugins/omnipath_client.py b/sos/report/plugins/omnipath_client.py
index 9bb3fb13..be04c70e 100644
--- a/sos/report/plugins/omnipath_client.py
+++ b/sos/report/plugins/omnipath_client.py
@@ -48,9 +48,8 @@ class OmnipathClient(Plugin, RedHatPlugin, UbuntuPlugin):
# This command calls 'depmod -a', so lets make sure we
# specified the 'allow-system-changes' option before running it.
if self.get_option('allow_system_changes'):
- self.add_cmd_output("opacapture %s" %
- join(self.get_cmd_output_path(),
- "opacapture.tgz"),
+ opa_fullpath = join(self.get_cmd_output_path(), "opacapture.tgz")
+ self.add_cmd_output(f"opacapture {opa_fullpath}",
changes=True)
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/openshift.py b/sos/report/plugins/openshift.py
index 6b14babd..dc7a514b 100644
--- a/sos/report/plugins/openshift.py
+++ b/sos/report/plugins/openshift.py
@@ -125,8 +125,8 @@ class Openshift(Plugin, RedHatPlugin):
return True
self._log_warn(
- "The login command failed with status: %s and error: %s"
- % (oc_res['status'], oc_res['output'])
+ "The login command failed with status: "
+ f"{oc_res['status']} and error: {oc_res['output']}"
)
return False
@@ -134,9 +134,9 @@ class Openshift(Plugin, RedHatPlugin):
token = self.get_option('token') or os.getenv('SOSOCPTOKEN', None)
if token:
- oc_res = self.exec_cmd("oc login %s --token=%s "
- "--insecure-skip-tls-verify=True"
- % (self.get_option('host'), token))
+ oc_res = self.exec_cmd(f"oc login {self.get_option('host')} "
+ f"--token={token} "
+ "--insecure-skip-tls-verify=True")
if oc_res['status'] == 0:
if self._check_oc_function():
return True
@@ -252,7 +252,7 @@ class Openshift(Plugin, RedHatPlugin):
self.collect_cluster_resources()
# get all namespaces, as data collection will be organized by that
- _nm_res = self.collect_cmd_output("%s namespaces" % self.oc_cmd)
+ _nm_res = self.collect_cmd_output(f"{self.oc_cmd} namespaces")
if _nm_res['status'] == 0:
nsps = [
n.split()[0] for n in _nm_res['output'].splitlines()[1:]
@@ -287,14 +287,14 @@ class Openshift(Plugin, RedHatPlugin):
]
for resource in global_resources:
- _subdir = "cluster_resources/%s" % resource
- _tag = ["ocp_%s" % resource]
- _res = self.collect_cmd_output("%s %s" % (self.oc_cmd, resource),
+ _subdir = f"cluster_resources/{resource}"
+ _tag = [f"ocp_{resource}"]
+ _res = self.collect_cmd_output(f"{self.oc_cmd} {resource}",
subdir=_subdir, tags=_tag)
if _res['status'] == 0:
for _res_name in _res['output'].splitlines()[1:]:
self.add_cmd_output(
- "oc describe %s %s" % (resource, _res_name.split()[0]),
+ f"oc describe {resource} {_res_name.split()[0]}",
subdir=_subdir
)
@@ -342,20 +342,20 @@ class Openshift(Plugin, RedHatPlugin):
]
# save to namespace-specific subdirs to keep the plugin dir organized
- subdir = "namespaces/%s" % namespace
+ subdir = f"namespaces/{namespace}"
# namespace-specific non-resource collections
- self.add_cmd_output("oc describe namespace %s" % namespace,
+ self.add_cmd_output(f"oc describe namespace {namespace}",
subdir=subdir)
for res in resources:
- _subdir = "%s/%s" % (subdir, res)
+ _subdir = f"{subdir}/{res}"
_tags = [
- "ocp_%s" % res,
- "ocp_%s_%s" % (namespace, res),
+ f"ocp_{res}",
+ f"ocp_{namespace}_{res}",
namespace
]
- _get_cmd = "%s --namespace=%s %s" % (self.oc_cmd, namespace, res)
+ _get_cmd = f"{self.oc_cmd} --namespace={namespace} {res}"
# get the 'normal' output first
_res_out = self.collect_cmd_output(
_get_cmd,
@@ -369,9 +369,9 @@ class Openshift(Plugin, RedHatPlugin):
for _instance in _instances:
_instance_name = _instance.split()[0]
self.add_cmd_output(
- "%s %s -o yaml" % (_get_cmd, _instance_name),
+ f"{_get_cmd} {_instance_name} -o yaml",
subdir=_subdir,
- suggest_filename="%s.yaml" % _instance_name
+ suggest_filename=f"{_instance_name}.yaml"
)
# check for podlogs here as a slight optimization to re-running
# 'oc get pods' on all namespaces
@@ -385,7 +385,7 @@ class Openshift(Plugin, RedHatPlugin):
:param pod_list list: A list of pod names
"""
- _log_dir = "namespaces/%s/pods/podlogs" % namespace
+ _log_dir = f"namespaces/{namespace}/pods/podlogs"
if self.get_option('podlogs-filter'):
# this allows shell-style regex which is more commonly known by
@@ -397,7 +397,7 @@ class Openshift(Plugin, RedHatPlugin):
for pod in pod_list:
if regex and not re.match(regex, pod):
continue
- _log_cmd = "oc logs --namespace=%s %s" % (namespace, pod)
+ _log_cmd = f"oc logs --namespace={namespace} {pod}"
self.add_cmd_output([
_log_cmd,
_log_cmd + " -p"
@@ -421,7 +421,7 @@ class Openshift(Plugin, RedHatPlugin):
'.*token.*.value' # don't blind match `.*token.*` and lose names
]
- regex = r'(\s*(%s):)(.*)' % '|'.join(_fields)
+ regex = fr'(\s*({"|".join(_fields)}):)(.*)'
self.do_path_regex_sub('/etc/kubernetes/*', regex, r'\1 *******')
# scrub secret content
diff --git a/sos/report/plugins/openssl.py b/sos/report/plugins/openssl.py
index c1f8e93f..593575a2 100644
--- a/sos/report/plugins/openssl.py
+++ b/sos/report/plugins/openssl.py
@@ -27,7 +27,7 @@ class OpenSSL(Plugin):
"challengePassword"
]
- regexp = r"^(\s*#?\s*(%s).*=)(.*)" % "|".join(protect_keys)
+ regexp = fr"^(\s*#?\s*({'|'.join(protect_keys)}).*=)(.*)"
self.do_file_sub(
'/etc/ssl/openssl.cnf',
diff --git a/sos/report/plugins/openstack_aodh.py b/sos/report/plugins/openstack_aodh.py
index b50a4bd4..f558cd15 100644
--- a/sos/report/plugins/openstack_aodh.py
+++ b/sos/report/plugins/openstack_aodh.py
@@ -82,12 +82,14 @@ class OpenStackAodh(Plugin):
connection_keys = ["connection", "backend_url", "transport_url"]
self.apply_regex_sub(
- r"(^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys),
+ fr"(^\s*({'|'.join(protect_keys)})\s*=\s*)(.*)",
r"\1*********"
)
+
+ join_con_keys = '|'.join(connection_keys)
+
self.apply_regex_sub(
- r"(^\s*(%s)\s*=\s*(.*)://(\w*):)(.*)(@(.*))" %
- "|".join(connection_keys),
+ fr"(^\s*({join_con_keys})\s*=\s*(.*)://(\w*):)(.*)(@(.*))",
r"\1*********\6"
)
diff --git a/sos/report/plugins/openstack_barbican.py b/sos/report/plugins/openstack_barbican.py
index 14a75f1d..9ad711b8 100644
--- a/sos/report/plugins/openstack_barbican.py
+++ b/sos/report/plugins/openstack_barbican.py
@@ -42,16 +42,17 @@ class OpenStackBarbican(Plugin, DebianPlugin, UbuntuPlugin):
]
self.do_file_sub(
"/etc/barbican/barbican.conf",
- r"(^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys),
+ fr"(^\s*({'|'.join(protect_keys)})\s*=\s*)(.*)",
r"\1********"
)
connection_keys = ["transport_url", "sql_connection"]
+ join_con_keys = "|".join(connection_keys)
+
self.do_path_regex_sub(
"/etc/barbican/barbican.conf",
- r"(^\s*(%s)\s*=\s*(.*)://(\w*):)(.*)(@(.*))" %
- "|".join(connection_keys),
+ fr"(^\s*({join_con_keys})\s*=\s*(.*)://(\w*):)(.*)(@(.*))",
r"\1*********\6")
diff --git a/sos/report/plugins/openstack_ceilometer.py b/sos/report/plugins/openstack_ceilometer.py
index 2e290cd2..c763ce1d 100644
--- a/sos/report/plugins/openstack_ceilometer.py
+++ b/sos/report/plugins/openstack_ceilometer.py
@@ -59,13 +59,14 @@ class OpenStackCeilometer(Plugin):
]
connection_keys = ["connection", "backend_url", "transport_url"]
+ join_con_keys = "|".join(connection_keys)
+
self.apply_regex_sub(
- r"(^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys),
+ fr"(^\s*({'|'.join(protect_keys)})\s*=\s*)(.*)",
r"\1*********"
)
self.apply_regex_sub(
- r"(^\s*(%s)\s*=\s*(.*)://(\w*):)(.*)(@(.*))" %
- "|".join(connection_keys),
+ fr"(^\s*({join_con_keys})\s*=\s*(.*)://(\w*):)(.*)(@(.*))",
r"\1*********\6"
)
diff --git a/sos/report/plugins/openstack_cinder.py b/sos/report/plugins/openstack_cinder.py
index 9935c87f..26ac024d 100644
--- a/sos/report/plugins/openstack_cinder.py
+++ b/sos/report/plugins/openstack_cinder.py
@@ -156,13 +156,14 @@ class OpenStackCinder(Plugin):
]
connection_keys = ["connection"]
+ join_con_keys = "|".join(connection_keys)
+
self.apply_regex_sub(
- r"(^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys),
+ fr"(^\s*({'|'.join(protect_keys)})\s*=\s*)(.*)",
r"\1*********"
)
self.apply_regex_sub(
- r"(^\s*(%s)\s*=\s*(.*)://(\w*):)(.*)(@(.*))" %
- "|".join(connection_keys),
+ fr"(^\s*({join_con_keys})\s*=\s*(.*)://(\w*):)(.*)(@(.*))",
r"\1*********\6"
)
diff --git a/sos/report/plugins/openstack_database.py b/sos/report/plugins/openstack_database.py
index 14bb1c32..6d3f5ea8 100644
--- a/sos/report/plugins/openstack_database.py
+++ b/sos/report/plugins/openstack_database.py
@@ -49,13 +49,13 @@ class OpenStackDatabase(Plugin):
if cname:
break
- fname = "clustercheck_%s" % cname if cname else None
+ fname = f"clustercheck_{cname}" if cname else None
self.add_cmd_output('clustercheck', container=cname, timeout=15,
suggest_filename=fname)
if self.get_option('dump') or self.get_option('dumpall'):
db_dump = self.get_mysql_db_string(container=cname)
- db_cmd = "mysqldump --opt %s" % db_dump
+ db_cmd = f"mysqldump --opt {db_dump}"
self.add_cmd_output(db_cmd, suggest_filename='mysql_dump.sql',
sizelimit=0, container=cname)
diff --git a/sos/report/plugins/openstack_designate.py b/sos/report/plugins/openstack_designate.py
index 0d5b7c29..20607507 100644
--- a/sos/report/plugins/openstack_designate.py
+++ b/sos/report/plugins/openstack_designate.py
@@ -70,7 +70,7 @@ class OpenStackDesignate(Plugin):
# commands
self.add_cmd_output([
- 'openstack %s --all-projects' % sub for sub in subcmds
+ f'openstack {sub} --all-projects' for sub in subcmds
])
# get recordsets for each zone
@@ -80,7 +80,7 @@ class OpenStackDesignate(Plugin):
for zone in ret['output'].splitlines():
zone = zone.split()[0]
self.add_cmd_output(
- "openstack recordset list --all-projects %s" % zone,
+ f"openstack recordset list --all-projects {zone}",
subdir='recordset')
def postproc(self):
@@ -89,7 +89,7 @@ class OpenStackDesignate(Plugin):
"ssl_key_password", "ssl_client_key_password",
"memcache_secret_key"
]
- regexp = r"(^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys)
+ regexp = fr"(^\s*({'|'.join(protect_keys)})\s*=\s*)(.*)"
self.do_path_regex_sub("/etc/designate/*", regexp, r"\1*********")
self.do_path_regex_sub(
diff --git a/sos/report/plugins/openstack_glance.py b/sos/report/plugins/openstack_glance.py
index 560e94a3..9b808572 100644
--- a/sos/report/plugins/openstack_glance.py
+++ b/sos/report/plugins/openstack_glance.py
@@ -106,12 +106,14 @@ class OpenStackGlance(Plugin):
connection_keys = ["connection"]
self.apply_regex_sub(
- r"(^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys),
+ fr"(^\s*({'|'.join(protect_keys)})\s*=\s*)(.*)",
r"\1*********"
)
+
+ join_con_keys = "|".join(connection_keys)
+
self.apply_regex_sub(
- r"(^\s*(%s)\s*=\s*(.*)://(\w*):)(.*)(@(.*))" %
- "|".join(connection_keys),
+ fr"(^\s*({join_con_keys})\s*=\s*(.*)://(\w*):)(.*)(@(.*))",
r"\1*********\6"
)
diff --git a/sos/report/plugins/openstack_heat.py b/sos/report/plugins/openstack_heat.py
index 9074e25a..97b66438 100644
--- a/sos/report/plugins/openstack_heat.py
+++ b/sos/report/plugins/openstack_heat.py
@@ -123,13 +123,14 @@ class OpenStackHeat(Plugin):
]
connection_keys = ["connection"]
+ join_con_keys = "|".join(connection_keys)
+
self.apply_regex_sub(
- r"(^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys),
+ fr"(^\s*({'|'.join(protect_keys)})\s*=\s*)(.*)",
r"\1*********"
)
self.apply_regex_sub(
- r"(^\s*(%s)\s*=\s*(.*)://(\w*):)(.*)(@(.*))" %
- "|".join(connection_keys),
+ fr"(^\s*({join_con_keys})\s*=\s*(.*)://(\w*):)(.*)(@(.*))",
r"\1*********\6"
)
diff --git a/sos/report/plugins/openstack_horizon.py b/sos/report/plugins/openstack_horizon.py
index 5405acdd..ed9d936d 100644
--- a/sos/report/plugins/openstack_horizon.py
+++ b/sos/report/plugins/openstack_horizon.py
@@ -50,7 +50,7 @@ class OpenStackHorizon(Plugin):
"SECRET_KEY", "EMAIL_HOST_PASSWORD"
]
- regexp = r"(^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys)
+ regexp = fr"(^\s*({'|'.join(protect_keys)})\s*=\s*)(.*)"
for regpath in [r"/etc/openstack-dashboard/.*\.json",
"/etc/openstack-dashboard/local_settings$"]:
self.do_path_regex_sub(regpath, regexp, r"\1*********")
diff --git a/sos/report/plugins/openstack_instack.py b/sos/report/plugins/openstack_instack.py
index e9e4e093..01b839ed 100644
--- a/sos/report/plugins/openstack_instack.py
+++ b/sos/report/plugins/openstack_instack.py
@@ -76,12 +76,12 @@ class OpenStackInstack(Plugin):
for _sid in stack_ids:
sid = _sid[1]
self.add_cmd_output([
- "openstack stack show %s" % sid,
- "openstack stack resource list -n 10 %s" % sid
+ f"openstack stack show {sid}",
+ f"openstack stack resource list -n 10 {sid}"
])
# get details on failed deployments
- cmd = "openstack stack resource list -f value -n 5 %s" % sid
+ cmd = f"openstack stack resource list -f value -n 5 {sid}"
deployments = self.exec_cmd(cmd)
for deployment in deployments['output'].splitlines():
if 'FAILED' in deployment:
@@ -93,8 +93,8 @@ class OpenStackInstack(Plugin):
continue
deploy = deployment.split()[1]
cmd = ("openstack software deployment "
- "show --long %s" % (deployment))
- fname = "failed-deployment-%s.log" % deploy
+ f"show --long {deployment}")
+ fname = f"failed-deployment-{deploy}.log"
self.add_cmd_output(cmd, suggest_filename=fname)
self.add_cmd_output("openstack object save "
@@ -136,13 +136,13 @@ class OpenStackInstack(Plugin):
"undercloud_swift_password",
"undercloud_tuskar_password",
]
- regexp = r"((%s)=)(.*)" % "|".join(protected_keys)
+ regexp = fr"(({'|'.join(protected_keys)})=)(.*)"
self.do_file_sub("/home/stack/.instack/install-undercloud.log",
regexp, r"\1*********")
self.do_file_sub(UNDERCLOUD_CONF_PATH, regexp, r"\1*********")
protected_json_keys = ["pm_password", "ssh-key", "password"]
- json_regexp = r'("(%s)": )(".*?")' % "|".join(protected_json_keys)
+ json_regexp = fr'("({"|".join(protected_json_keys)})": )(".*?")'
self.do_file_sub("/home/stack/instackenv.json", json_regexp,
r"\1*********")
self.do_file_sub('/home/stack/.tripleo/history',
diff --git a/sos/report/plugins/openstack_ironic.py b/sos/report/plugins/openstack_ironic.py
index ef2df232..2cb24f31 100644
--- a/sos/report/plugins/openstack_ironic.py
+++ b/sos/report/plugins/openstack_ironic.py
@@ -71,9 +71,8 @@ class OpenStackIronic(Plugin):
for path in ['/var/lib/ironic', '/httpboot', '/tftpboot',
self.ins_puppet_gen + '/var/lib/httpboot/',
self.ins_puppet_gen + '/var/lib/tftpboot/']:
- self.add_cmd_output('ls -laRt %s' % path)
- self.add_cmd_output('ls -laRt %s' %
- (self.var_puppet_gen + path))
+ self.add_cmd_output(f'ls -laRt {path}')
+ self.add_cmd_output(f'ls -laRt {self.var_puppet_gen + path}')
# Let's get the packages from the containers, always helpful when
# troubleshooting.
@@ -110,7 +109,7 @@ class OpenStackIronic(Plugin):
])
for path in ['/var/lib/ironic', '/httpboot', '/tftpboot']:
- self.add_cmd_output('ls -laRt %s' % path)
+ self.add_cmd_output(f'ls -laRt {path}')
self.add_file_tags({
".*/etc/ironic/ironic.conf": "ironic_conf"
@@ -147,13 +146,14 @@ class OpenStackIronic(Plugin):
]
connection_keys = ["connection", "sql_connection"]
+ join_con_keys = "|".join(connection_keys)
+
self.apply_regex_sub(
- r"(^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys),
+ fr"(^\s*({'|'.join(protect_keys)})\s*=\s*)(.*)",
r"\1*********"
)
self.apply_regex_sub(
- r"(^\s*(%s)\s*=\s*(.*)://(\w*):)(.*)(@(.*))" %
- "|".join(connection_keys),
+ fr"(^\s*({join_con_keys})\s*=\s*(.*)://(\w*):)(.*)(@(.*))",
r"\1*********\6"
)
@@ -186,7 +186,7 @@ class RedHatIronic(OpenStackIronic, RedHatPlugin):
if uuid.strip()]
for uuid in uuids:
self.add_cmd_output('openstack baremetal introspection '
- 'data save %s' % uuid)
+ f'data save {uuid}')
def setup(self):
super().setup()
diff --git a/sos/report/plugins/openstack_keystone.py b/sos/report/plugins/openstack_keystone.py
index dd22d41c..220a0372 100644
--- a/sos/report/plugins/openstack_keystone.py
+++ b/sos/report/plugins/openstack_keystone.py
@@ -105,20 +105,21 @@ class OpenStackKeystone(Plugin):
]
connection_keys = ["connection"]
+ join_con_keys = "|".join(connection_keys)
+
self.apply_regex_sub(
- r"(^\s*(%s)\s*(=\s*)?)(.*)" % "|".join(protect_keys),
+ fr"(^\s*({'|'.join(protect_keys)})\s*(=\s*)?)(.*)",
r"\1*********"
)
self.apply_regex_sub(
- r"(^\s*(%s)\s*=\s*(.*)://(\w*):)(.*)(@(.*))" %
- "|".join(connection_keys),
+ fr"(^\s*({join_con_keys})\s*=\s*(.*)://(\w*):)(.*)(@(.*))",
r"\1*********\6"
)
# obfuscate LDAP plaintext passwords in domain config dir
self.do_path_regex_sub(
self.domain_config_dir,
- r"(^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys),
+ fr"(^\s*({'|'.join(protect_keys)})\s*=\s*)(.*)",
r"\1********"
)
diff --git a/sos/report/plugins/openstack_manila.py b/sos/report/plugins/openstack_manila.py
index 2bac0acc..00dea7f2 100644
--- a/sos/report/plugins/openstack_manila.py
+++ b/sos/report/plugins/openstack_manila.py
@@ -21,11 +21,11 @@ class OpenStackManila(Plugin):
def setup(self):
- config_dir = "%s/etc/manila" % (
+ pre_conf = (
self.var_puppet_gen if self.container_exists('.*manila_api') else
- ''
- )
- manila_cmd = "manila-manage --config-dir %s db version" % config_dir
+ '')
+ config_dir = f"{pre_conf}/etc/manila"
+ manila_cmd = f"manila-manage --config-dir {config_dir} db version"
self.add_cmd_output(manila_cmd, suggest_filename="manila_db_version")
self.add_copy_spec([
@@ -64,13 +64,14 @@ class OpenStackManila(Plugin):
"memcache_secret_key"]
connection_keys = ["connection", "sql_connection"]
+ join_con_keys = "|".join(connection_keys)
+
self.apply_regex_sub(
- r"(^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys),
+ fr"(^\s*({'|'.join(protect_keys)})\s*=\s*)(.*)",
r"\1*********"
)
self.apply_regex_sub(
- r"(^\s*(%s)\s*=\s*(.*)://(\w*):)(.*)(@(.*))" %
- "|".join(connection_keys),
+ fr"(^\s*({join_con_keys})\s*=\s*(.*)://(\w*):)(.*)(@(.*))",
r"\1*********\6"
)
diff --git a/sos/report/plugins/openstack_masakari.py b/sos/report/plugins/openstack_masakari.py
index 07def305..1a692ddb 100644
--- a/sos/report/plugins/openstack_masakari.py
+++ b/sos/report/plugins/openstack_masakari.py
@@ -58,15 +58,16 @@ class OpenStackMasakari(Plugin, UbuntuPlugin):
"memcache_secret_key", "rabbit_password"]
connection_keys = ["connection", "sql_connection"]
+ join_con_keys = "|".join(connection_keys)
+
self.do_path_regex_sub(
f"{self.config_dir}/*",
- r"(^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys),
+ fr"(^\s*({'|'.join(protect_keys)})\s*=\s*)(.*)",
r"\1*********"
)
self.do_path_regex_sub(
f"{self.config_dir}/*",
- r"(^\s*(%s)\s*=\s*(.*)://(\w*):)(.*)(@(.*))" %
- "|".join(connection_keys),
+ fr"(^\s*({join_con_keys})\s*=\s*(.*)://(\w*):)(.*)(@(.*))",
r"\1*********\6"
)
diff --git a/sos/report/plugins/openstack_masakarimonitors.py b/sos/report/plugins/openstack_masakarimonitors.py
index 5e1e83e5..9d4c80e9 100644
--- a/sos/report/plugins/openstack_masakarimonitors.py
+++ b/sos/report/plugins/openstack_masakarimonitors.py
@@ -49,7 +49,7 @@ class OpenStackMasakariMonitors(Plugin, UbuntuPlugin):
self.do_path_regex_sub(
f"{self.config_dir}/*",
- r"(^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys),
+ fr"(^\s*({'|'.join(protect_keys)})\s*=\s*)(.*)",
r"\1*********"
)
diff --git a/sos/report/plugins/openstack_neutron.py b/sos/report/plugins/openstack_neutron.py
index ae211567..5efda2b5 100644
--- a/sos/report/plugins/openstack_neutron.py
+++ b/sos/report/plugins/openstack_neutron.py
@@ -102,13 +102,14 @@ class OpenStackNeutron(Plugin):
]
connection_keys = ["connection"]
+ join_con_keys = "|".join(connection_keys)
+
self.apply_regex_sub(
- r"(^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys),
+ fr"(^\s*({'|'.join(protect_keys)})\s*=\s*)(.*)",
r"\1*********"
)
self.apply_regex_sub(
- r"(^\s*(%s)\s*=\s*(.*)://(\w*):)(.*)(@(.*))" %
- "|".join(connection_keys),
+ fr"(^\s*({join_con_keys})\s*=\s*(.*)://(\w*):)(.*)(@(.*))",
r"\1*********\6"
)
diff --git a/sos/report/plugins/openstack_nova.py b/sos/report/plugins/openstack_nova.py
index 712aecab..728aed1e 100644
--- a/sos/report/plugins/openstack_nova.py
+++ b/sos/report/plugins/openstack_nova.py
@@ -135,7 +135,7 @@ class OpenStackNova(Plugin):
self.var_puppet_gen + "_libvirt/var/lib/nova/.ssh/config"
] + list(
filter(re.compile('^((?!libvirt.+httpd).)*$').match,
- ['%s%s%s' % (self.var_puppet_gen, p, s)
+ [f'{self.var_puppet_gen}{p}{s}'
for p in npaths for s in syspaths
]))
self.add_copy_spec(specs)
@@ -145,7 +145,7 @@ class OpenStackNova(Plugin):
self.do_path_regex_sub("/etc/nova/*", regexp, subst)
for npath in ['', '_libvirt', '_metadata', '_placement']:
self.do_path_regex_sub(
- "%s%s/etc/nova/*" % (self.var_puppet_gen, npath),
+ f"{self.var_puppet_gen}{npath}/etc/nova/*",
regexp, subst)
def postproc(self):
@@ -160,13 +160,14 @@ class OpenStackNova(Plugin):
]
connection_keys = ["connection", "sql_connection"]
+ join_con_keys = "|".join(connection_keys)
+
self.apply_regex_sub(
- r"(^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys),
+ fr"(^\s*({'|'.join(protect_keys)})\s*=\s*)(.*)",
r"\1*********"
)
self.apply_regex_sub(
- r"(^\s*(%s)\s*=\s*(.*)://(\w*):)(.*)(@(.*))" %
- "|".join(connection_keys),
+ fr"(^\s*({join_con_keys})\s*=\s*(.*)://(\w*):)(.*)(@(.*))",
r"\1*********\6"
)
diff --git a/sos/report/plugins/openstack_octavia.py b/sos/report/plugins/openstack_octavia.py
index b2706521..3ecbe23d 100644
--- a/sos/report/plugins/openstack_octavia.py
+++ b/sos/report/plugins/openstack_octavia.py
@@ -87,17 +87,17 @@ class OpenStackOctavia(Plugin):
for res in self.resources:
# get a list for each resource type
- self.add_cmd_output('openstack loadbalancer %s list' % res,
+ self.add_cmd_output(f'openstack loadbalancer {res} list',
subdir=res)
# get details from each resource
- cmd = "openstack loadbalancer %s list -f value -c id" % res
+ cmd = f"openstack loadbalancer {res} list -f value -c id"
ret = self.exec_cmd(cmd)
if ret['status'] == 0:
for ent in ret['output'].splitlines():
ent = ent.split()[0]
self.add_cmd_output(
- "openstack loadbalancer %s show %s" % (res, ent),
+ f"openstack loadbalancer {res} show {ent}",
subdir=res)
# get capability details from each provider
@@ -108,7 +108,7 @@ class OpenStackOctavia(Plugin):
provider = provider.split()[0]
self.add_cmd_output(
"openstack loadbalancer provider capability list"
- " %s" % provider,
+ f" {provider}",
subdir='provider_capability')
def postproc(self):
@@ -117,7 +117,7 @@ class OpenStackOctavia(Plugin):
"connection", "transport_url", "server_certs_key_passphrase",
"memcache_secret_key"
]
- regexp = r"(^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys)
+ regexp = fr"(^\s*({'|'.join(protect_keys)})\s*=\s*)(.*)"
self.do_path_regex_sub("/etc/octavia/*", regexp, r"\1*********")
self.do_path_regex_sub(
diff --git a/sos/report/plugins/openstack_placement.py b/sos/report/plugins/openstack_placement.py
index 2dcb9463..4ab3d2f0 100644
--- a/sos/report/plugins/openstack_placement.py
+++ b/sos/report/plugins/openstack_placement.py
@@ -108,13 +108,14 @@ class OpenStackPlacement(Plugin):
protect_keys = ["password", "memcache_secret_key"]
connection_keys = ["database_connection", "slave_connection"]
+ join_con_keys = "|".join(connection_keys)
+
self.apply_regex_sub(
- r"(^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys),
+ fr"(^\s*({'|'.join(protect_keys)})\s*=\s*)(.*)",
r"\1*********"
)
self.apply_regex_sub(
- r"(^\s*(%s)\s*=\s*(.*)://(\w*):)(.*)(@(.*))" %
- "|".join(connection_keys),
+ fr"(^\s*({join_con_keys})\s*=\s*(.*)://(\w*):)(.*)(@(.*))",
r"\1*********\6"
)
diff --git a/sos/report/plugins/openstack_sahara.py b/sos/report/plugins/openstack_sahara.py
index 1a454a7f..eeb5c973 100644
--- a/sos/report/plugins/openstack_sahara.py
+++ b/sos/report/plugins/openstack_sahara.py
@@ -52,13 +52,14 @@ class OpenStackSahara(Plugin):
]
connection_keys = ["connection"]
+ join_con_keys = "|".join(connection_keys)
+
self.apply_regex_sub(
- r"(^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys),
+ fr"(^\s*({'|'.join(protect_keys)})\s*=\s*)(.*)",
r"\1*********"
)
self.apply_regex_sub(
- r"(^\s*(%s)\s*=\s*(.*)://(\w*):)(.*)(@(.*))" %
- "|".join(connection_keys),
+ fr"(^\s*({join_con_keys})\s*=\s*(.*)://(\w*):)(.*)(@(.*))",
r"\1*********\6"
)
diff --git a/sos/report/plugins/openstack_swift.py b/sos/report/plugins/openstack_swift.py
index f1da8763..9f3e2efb 100644
--- a/sos/report/plugins/openstack_swift.py
+++ b/sos/report/plugins/openstack_swift.py
@@ -63,12 +63,14 @@ class OpenStackSwift(Plugin):
connection_keys = ["connection", "sql_connection"]
self.apply_regex_sub(
- r"(^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys),
+ fr"(^\s*({'|'.join(protect_keys)})\s*=\s*)(.*)",
r"\1*********"
)
+
+ join_con_keys = '|'.join(connection_keys)
+
self.apply_regex_sub(
- r"(^\s*(%s)\s*=\s*(.*)://(\w*):)(.*)(@(.*))" %
- "|".join(connection_keys),
+ fr"(^\s*({join_con_keys})\s*=\s*(.*)://(\w*):)(.*)(@(.*))",
r"\1*********\6"
)
diff --git a/sos/report/plugins/openstack_trove.py b/sos/report/plugins/openstack_trove.py
index b54156c0..4eb7a950 100644
--- a/sos/report/plugins/openstack_trove.py
+++ b/sos/report/plugins/openstack_trove.py
@@ -51,13 +51,14 @@ class OpenStackTrove(Plugin):
]
connection_keys = ["connection"]
+ join_con_keys = "|".join(connection_keys)
+
self.apply_regex_sub(
- r"(^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys),
+ fr"(^\s*({'|'.join(protect_keys)})\s*=\s*)(.*)",
r"\1*********"
)
self.apply_regex_sub(
- r"(^\s*(%s)\s*=\s*(.*)://(\w*):)(.*)(@(.*))" %
- "|".join(connection_keys),
+ fr"(^\s*({join_con_keys})\s*=\s*(.*)://(\w*):)(.*)(@(.*))",
r"\1*********\6"
)
diff --git a/sos/report/plugins/opensvc.py b/sos/report/plugins/opensvc.py
index 7c65883f..7b1319fe 100644
--- a/sos/report/plugins/opensvc.py
+++ b/sos/report/plugins/opensvc.py
@@ -18,12 +18,12 @@ class Opensvc(Plugin, IndependentPlugin):
def get_status(self, kind):
""" Get the status of opensvc management service """
- getobjs = self.collect_cmd_output("om %s ls --color=no" % kind)
+ getobjs = self.collect_cmd_output(f"om {kind} ls --color=no")
dirname = kind + '_status'
if getobjs['status'] == 0:
for line in getobjs['output'].splitlines():
self.add_cmd_output(
- "om %s print status --color=no" % line,
+ f"om {line} print status --color=no",
subdir=dirname
)
diff --git a/sos/report/plugins/openvswitch.py b/sos/report/plugins/openvswitch.py
index 015dbf71..4f8c7b9b 100644
--- a/sos/report/plugins/openvswitch.py
+++ b/sos/report/plugins/openvswitch.py
@@ -216,7 +216,7 @@ class OpenVSwitch(Plugin):
])
self.add_journal(units="virtual-accelerator")
for table in ['filter', 'mangle', 'raw', 'nat']:
- self.add_cmd_output(["fpcmd nf4-rules %s" % table])
+ self.add_cmd_output([f"fpcmd nf4-rules {table}"])
# 6wind doesn't care on which bridge the ports are, there's only
# one bridge and it's alubr0
@@ -227,7 +227,7 @@ class OpenVSwitch(Plugin):
if mport:
port_name = mport.group(2)
self.add_cmd_output([
- "fp-cli dpdk-cp-filter-budget %s" % port_name,
+ f"fp-cli dpdk-cp-filter-budget {port_name}",
])
def collect_datapath(self):
@@ -236,11 +236,11 @@ class OpenVSwitch(Plugin):
if dp_list_result['status'] == 0:
for dps in dp_list_result['output'].splitlines():
self.add_cmd_output([
- "%s dpctl/show -s %s" % (self.actl, dps),
- "%s dpctl/dump-flows -m %s" % (self.actl, dps),
- "%s dpctl/dump-conntrack -m %s" % (self.actl, dps),
- "%s dpctl/ct-stats-show -m %s" % (self.actl, dps),
- "%s dpctl/ipf-get-status %s" % (self.actl, dps),
+ f"{self.actl} dpctl/show -s {dps}",
+ f"{self.actl} dpctl/dump-flows -m {dps}",
+ f"{self.actl} dpctl/dump-conntrack -m {dps}",
+ f"{self.actl} dpctl/ct-stats-show -m {dps}",
+ f"{self.actl} dpctl/ipf-get-status {dps}",
])
def collect_ovs_bridge_info(self):
@@ -252,18 +252,18 @@ class OpenVSwitch(Plugin):
for bri in br_list_result['output'].splitlines():
self.add_cmd_output([
- "%s bridge/dump-flows --offload-stats %s" % (self.actl, bri),
- "%s dpif/show-dp-features %s" % (self.actl, bri),
- "%s fdb/show %s" % (self.actl, bri),
- "%s fdb/stats-show %s" % (self.actl, bri),
- "%s mdb/show %s" % (self.actl, bri),
- "ovs-ofctl dump-flows %s" % bri,
- "ovs-ofctl dump-ports-desc %s" % bri,
- "ovs-ofctl dump-ports %s" % bri,
- "ovs-ofctl queue-get-config %s" % bri,
- "ovs-ofctl queue-stats %s" % bri,
- "ovs-ofctl show %s" % bri,
- "ovs-ofctl dump-groups %s" % bri,
+ f"{self.actl} bridge/dump-flows --offload-stats {bri}",
+ f"{self.actl} dpif/show-dp-features {bri}",
+ f"{self.actl} fdb/show {bri}",
+ f"{self.actl} fdb/stats-show {bri}",
+ f"{self.actl} mdb/show {bri}",
+ f"ovs-ofctl dump-flows {bri}",
+ f"ovs-ofctl dump-ports-desc {bri}",
+ f"ovs-ofctl dump-ports {bri}",
+ f"ovs-ofctl queue-get-config {bri}",
+ f"ovs-ofctl queue-stats {bri}",
+ f"ovs-ofctl show {bri}",
+ f"ovs-ofctl dump-groups {bri}",
])
self.get_flow_versions(bri)
@@ -272,33 +272,33 @@ class OpenVSwitch(Plugin):
if self.check_dpdk:
iface_list_result = self.exec_cmd(
- "ovs-vsctl -t 5 list-ifaces %s" % bri
+ f"ovs-vsctl -t 5 list-ifaces {bri}"
)
if iface_list_result['status'] == 0:
for iface in iface_list_result['output'].splitlines():
self.add_cmd_output(
- "ovs-appctl netdev-dpdk/get-mempool-info %s" %
- iface)
+ f"ovs-appctl netdev-dpdk/get-mempool-info "
+ f"{iface}")
if self.check_6wind:
self.add_cmd_output([
- "%s evpn/vip-list-show %s" % (self.actl, bri),
- "%s bridge/dump-conntracks-summary %s" % (self.actl, bri),
- "%s bridge/acl-table ingress/egress %s" % (self.actl, bri),
- "%s bridge/acl-table %s" % (self.actl, bri),
- "%s ofproto/show %s" % (self.actl, bri),
+ f"{self.actl} evpn/vip-list-show {bri}",
+ f"{self.actl} bridge/dump-conntracks-summary {bri}",
+ f"{self.actl} bridge/acl-table ingress/egress {bri}",
+ f"{self.actl} bridge/acl-table {bri}",
+ f"{self.actl} ofproto/show {bri}",
])
vrf_list = self.collect_cmd_output(
- "%s vrf/list %s" % (self.actl, bri))
+ f"{self.actl} vrf/list {bri}")
if vrf_list['status'] == 0:
vrfs = vrf_list['output'].split()[1:]
for vrf in vrfs:
self.add_cmd_output([
- "%s vrf/route-table %s" % (self.actl, vrf),
+ f"{self.actl} vrf/route-table {vrf}",
])
evpn_list = self.collect_cmd_output(
- "ovs-appctl evpn/list %s" % bri)
+ f"ovs-appctl evpn/list {bri}")
if evpn_list['status'] == 0:
evpns = evpn_list['output'].split()[1:]
for evpn in evpns:
@@ -386,18 +386,18 @@ class OpenVSwitch(Plugin):
if port_list_result['status'] == 0:
for port in port_list_result['output'].splitlines():
self.add_cmd_output([
- "ovs-appctl cfm/show %s" % port,
- "ovs-appctl qos/show %s" % port,
+ f"ovs-appctl cfm/show {port}",
+ f"ovs-appctl qos/show {port}",
# Not all ports are "bond"s, but all "bond"s are
# a single port
- "ovs-appctl bond/show %s" % port,
+ f"ovs-appctl bond/show {port}",
# In the case of IPSec, we should pull the config
- "ovs-vsctl get Interface %s options" % port,
+ f"ovs-vsctl get Interface {port} options",
])
if self.check_dpdk:
self.add_cmd_output(
- "ovs-appctl netdev-dpdk/get-mempool-info %s" % port)
+ f"ovs-appctl netdev-dpdk/get-mempool-info {port}")
class RedHatOpenVSwitch(OpenVSwitch, RedHatPlugin):
diff --git a/sos/report/plugins/origin.py b/sos/report/plugins/origin.py
index 0504a39d..31308fbc 100644
--- a/sos/report/plugins/origin.py
+++ b/sos/report/plugins/origin.py
@@ -84,7 +84,7 @@ class OpenShiftOrigin(Plugin):
node_certs = self.path_join(self.node_base_dir, "certs", "*")
node_client_ca = self.path_join(self.node_base_dir, "client-ca.crt")
admin_cfg = self.path_join(self.master_base_dir, "admin.kubeconfig")
- oc_cmd_admin = "%s --config=%s" % ("oc", admin_cfg)
+ oc_cmd_admin = f"oc --config={admin_cfg}"
static_pod_logs_cmd = "master-logs"
# Note that a system can run both a master and a node.
@@ -100,12 +100,12 @@ class OpenShiftOrigin(Plugin):
self.add_copy_spec(self.path_join(self.static_pod_dir,
"*.yaml"))
self.add_cmd_output([
- "%s api api" % static_pod_logs_cmd,
- "%s controllers controllers" % static_pod_logs_cmd,
+ f"{static_pod_logs_cmd} api api",
+ f"{static_pod_logs_cmd} controllers controllers",
])
if self.is_static_etcd():
- self.add_cmd_output("%s etcd etcd" % static_pod_logs_cmd)
+ self.add_cmd_output(f"{static_pod_logs_cmd} etcd etcd")
# Possible enhancements:
# some thoughts about information that might also be useful
@@ -132,7 +132,7 @@ class OpenShiftOrigin(Plugin):
]
self.add_cmd_output([
- '%s %s' % (oc_cmd_admin, subcmd) for subcmd in subcmds
+ f'{oc_cmd_admin} {subcmd}' for subcmd in subcmds
])
jcmds = [
@@ -142,7 +142,7 @@ class OpenShiftOrigin(Plugin):
]
self.add_cmd_output([
- '%s get -o json %s' % (oc_cmd_admin, jcmd) for jcmd in jcmds
+ f'{oc_cmd_admin} get -o json {jcmd}' for jcmd in jcmds
])
nmsps = [
@@ -154,8 +154,8 @@ class OpenShiftOrigin(Plugin):
]
self.add_cmd_output([
- '%s get -o json deploymentconfig,deployment,daemonsets -n %s'
- % (oc_cmd_admin, n) for n in nmsps
+ f'{oc_cmd_admin} get -o json deploymentconfig,deployment,'
+ f'daemonsets -n {n}' for n in nmsps
])
if not self.is_static_pod_compatible():
@@ -164,11 +164,9 @@ class OpenShiftOrigin(Plugin):
"atomic-openshift-master-controllers"])
# get logs from the infrastructure pods running in the default ns
- pods = self.exec_cmd("%s get pod -o name -n default"
- % oc_cmd_admin)
+ pods = self.exec_cmd(f"{oc_cmd_admin} get pod -o name -n default")
for pod in pods['output'].splitlines():
- self.add_cmd_output("%s logs -n default %s"
- % (oc_cmd_admin, pod))
+ self.add_cmd_output(f"{oc_cmd_admin} logs -n default {pod}")
# Note that a system can run both a master and a node.
# See "Master vs. node" above.
diff --git a/sos/report/plugins/ovirt.py b/sos/report/plugins/ovirt.py
index cbd97af6..31a9dcde 100644
--- a/sos/report/plugins/ovirt.py
+++ b/sos/report/plugins/ovirt.py
@@ -66,7 +66,7 @@ class Ovirt(Plugin, RedHatPlugin):
def setup(self):
if self.get_option('jbosstrace') and self.is_installed('ovirt-engine'):
engine_pattern = r"^ovirt-engine\ -server.*jboss-modules.jar"
- pgrep = "pgrep -f '%s'" % engine_pattern
+ pgrep = f"pgrep -f '{engine_pattern}'"
res = self.exec_cmd(pgrep)
engine_pids = [int(x) for x in res['output'].splitlines()]
if not engine_pids:
@@ -113,13 +113,13 @@ class Ovirt(Plugin, RedHatPlugin):
self.add_cmd_output([
# process certificate files
- "openssl x509 -in %s -text -noout" % c for c in certificates
+ f"openssl x509 -in {c} -text -noout" for c in certificates
])
self.add_cmd_output([
# process TrustStore certificates
- "keytool -list -storepass %s -rfc -keystore %s" %
- (p, c) for (p, c) in keystores
+ f"keytool -list -storepass {p} -rfc -keystore {c}"
+ for (p, c) in keystores
])
# 3.x line uses engine-manage-domains, 4.x uses ovirt-aaa-jdbc-tool
@@ -128,9 +128,9 @@ class Ovirt(Plugin, RedHatPlugin):
jdbc_tool = 'ovirt-aaa-jdbc-tool'
if is_executable(manage_domains):
- self.add_cmd_output('%s list' % manage_domains)
+ self.add_cmd_output(f'{manage_domains} list')
if is_executable(extensions_tool):
- self.add_cmd_output('%s info list-extensions' % extensions_tool)
+ self.add_cmd_output(f'{extensions_tool} info list-extensions')
if is_executable('ovirt-aaa-jdbc-tool'):
subcmds = [
'query --what=user',
@@ -138,7 +138,7 @@ class Ovirt(Plugin, RedHatPlugin):
'settings show'
]
- self.add_cmd_output(['%s %s' % (jdbc_tool, sc) for sc in subcmds])
+ self.add_cmd_output([f'{jdbc_tool} {sc}' for sc in subcmds])
# Copy engine config files.
self.add_copy_spec([
@@ -205,7 +205,7 @@ class Ovirt(Plugin, RedHatPlugin):
)
for filename in engine_files:
self.do_file_sub(
- "/var/tmp/ovirt-engine/config/%s" % filename,
+ f"/var/tmp/ovirt-engine/config/{filename}",
r"(<password>)(.*)(</password>)",
r"\1********\3"
)
@@ -237,7 +237,7 @@ class Ovirt(Plugin, RedHatPlugin):
key_list = [x for x in sensitive_keys.split(':') if x]
self.do_path_regex_sub(
self.DB_PASS_FILES,
- r'(%s)=(.*)' % "|".join(key_list),
+ fr'({"|".join(key_list)})=(.*)',
r'\1=********'
)
@@ -263,7 +263,7 @@ class Ovirt(Plugin, RedHatPlugin):
"pool.default.ssl.truststore.password",
"config.datasource.dbpassword"
]
- regexp = r"(^\s*#*(%s)\s*=\s*)(.*)" % "|".join(protect_keys)
+ regexp = fr"(^\s*#*({'|'.join(protect_keys)})\s*=\s*)(.*)"
self.do_path_regex_sub(r"/etc/ovirt-engine/aaa/.*\.properties", regexp,
r"\1*********")
diff --git a/sos/report/plugins/ovirt_engine_backup.py b/sos/report/plugins/ovirt_engine_backup.py
index 6adf5c98..a964746d 100644
--- a/sos/report/plugins/ovirt_engine_backup.py
+++ b/sos/report/plugins/ovirt_engine_backup.py
@@ -30,18 +30,15 @@ class OVirtEngineBackup(Plugin, RedHatPlugin):
now = datetime.now().strftime("%Y%m%d%H%M%S")
backup_filename = self.path_join(
self.get_option("backupdir"),
- "engine-db-backup-%s.tar.gz" % (now)
+ f"engine-db-backup-{now}.tar.gz"
)
log_filename = self.path_join(
self.get_option("backupdir"),
- "engine-db-backup-%s.log" % (now)
+ f"engine-db-backup-{now}.log"
)
cmd = ("engine-backup --mode=backup --scope=db"
- " --file=%s --log=%s --tmpdir=%s") % (
- backup_filename,
- log_filename,
- self.get_option("tmpdir")
- )
+ f" --file={backup_filename} --log={log_filename}"
+ f" --tmpdir={self.get_option('tmpdir')}")
res = self.collect_cmd_output(cmd, suggest_filename="engine-backup")
if res['status'] == 0:
self.add_copy_spec([
diff --git a/sos/report/plugins/ovirt_node.py b/sos/report/plugins/ovirt_node.py
index 5aad7ee3..491dae4a 100644
--- a/sos/report/plugins/ovirt_node.py
+++ b/sos/report/plugins/ovirt_node.py
@@ -50,7 +50,7 @@ class OvirtNode(Plugin, RedHatPlugin):
# Collect certificate info
self.add_cmd_output([
- 'openssl x509 -in %s -text -noout' % c for c in certificates
+ f'openssl x509 -in {c} -text -noout' for c in certificates
])
diff --git a/sos/report/plugins/ovn_central.py b/sos/report/plugins/ovn_central.py
index bcc937f4..8144dd44 100644
--- a/sos/report/plugins/ovn_central.py
+++ b/sos/report/plugins/ovn_central.py
@@ -35,11 +35,11 @@ class OVNCentral(Plugin):
def _find_sock(self, path, regex_name):
_sfile = os.path.join(path, regex_name)
if self.container_name:
- res = self.exec_cmd("ls %s" % path, container=self.container_name)
+ res = self.exec_cmd(f"ls {path}", container=self.container_name)
if res['status'] != 0 or '\n' not in res['output']:
self._log_error(
"Could not retrieve ovn_controller socket path "
- "from container %s" % self.container_name
+ f"from container {self.container_name}"
)
else:
pattern = re.compile(regex_name)
@@ -52,17 +52,17 @@ class OVNCentral(Plugin):
def get_tables_from_schema(self, filename, skip=None):
""" Get tables from schema """
if self.container_name:
- cmd = "cat %s" % filename
+ cmd = f"cat {filename}"
res = self.exec_cmd(cmd, timeout=None, foreground=True,
container=self.container_name)
if res['status'] != 0:
self._log_error("Could not retrieve DB schema file from "
- "container %s" % self.container_name)
+ f"container {self.container_name}")
return None
try:
db_schema = json.loads(res['output'])
except Exception: # pylint: disable=broad-except
- self._log_error("Cannot parse JSON file %s" % filename)
+ self._log_error(f"Cannot parse JSON file {filename}")
return None
else:
try:
@@ -71,18 +71,17 @@ class OVNCentral(Plugin):
try:
db_schema = json.load(file)
except Exception: # pylint: disable=broad-except
- self._log_error(
- "Cannot parse JSON file %s" % filename)
+ self._log_error(f"Cannot parse JSON file {filename}")
return None
except IOError as ex:
self._log_error(
- "Could not open DB schema file %s: %s" % (filename, ex))
+ f"Could not open DB schema file {filename}: {ex}")
return None
try:
return [table for table in dict.keys(
db_schema['tables']) if table not in skip]
except AttributeError:
- self._log_error("DB schema %s has no 'tables' key" % filename)
+ self._log_error(f"DB schema {filename} has no 'tables' key")
return None
def add_database_output(self, tables, cmds, ovn_cmd):
@@ -90,7 +89,7 @@ class OVNCentral(Plugin):
if not tables:
return
for table in tables:
- cmds.append('%s list %s' % (ovn_cmd, table))
+ cmds.append(f'{ovn_cmd} list {table}')
def setup(self):
# check if env is a clustered or non-clustered one
@@ -188,7 +187,7 @@ class OVNCentral(Plugin):
if os.path.exists(dbfilepath):
self.add_copy_spec(dbfilepath)
self.add_cmd_output(
- "ls -lan %s" % dbfilepath, foreground=True)
+ f"ls -lan {dbfilepath}", foreground=True)
if ovs_dbdir:
self.add_copy_spec(self.path_join(ovs_dbdir, dbfile))
diff --git a/sos/report/plugins/pacemaker.py b/sos/report/plugins/pacemaker.py
index b8fe47ae..4575d333 100644
--- a/sos/report/plugins/pacemaker.py
+++ b/sos/report/plugins/pacemaker.py
@@ -111,8 +111,8 @@ class Pacemaker(Plugin):
crm_from = self.get_option("crm_from")
else:
self._log_error(
- "crm_from parameter '%s' is not a valid date: using "
- "default" % self.get_option("crm_from"))
+ f"crm_from parameter '{self.get_option('crm_from')}' is "
+ "not a valid date: using default")
crm_dest = self.get_cmd_output_path(name="crm_report", make=False)
if self.get_option("crm_scrub"):
@@ -122,9 +122,8 @@ class Pacemaker(Plugin):
self._log_warn("scrubbing of crm passwords has been disabled:")
self._log_warn("data collected by crm_report may contain"
" sensitive values.")
- self.add_cmd_output('crm_report --sos-mode %s -S -d '
- ' --dest %s --from "%s"' %
- (crm_scrub, crm_dest, crm_from),
+ self.add_cmd_output(f'crm_report --sos-mode {crm_scrub} -S -d '
+ f' --dest {crm_dest} --from "{crm_from}"',
chroot=self.tmp_in_sysroot())
# collect user-defined logfiles, matching a shell-style syntax:
diff --git a/sos/report/plugins/pam.py b/sos/report/plugins/pam.py
index 5dc2fa81..81e74925 100644
--- a/sos/report/plugins/pam.py
+++ b/sos/report/plugins/pam.py
@@ -30,7 +30,7 @@ class Pam(Plugin):
"/etc/security"
])
self.add_cmd_output([
- "ls -lanF %s" % self.security_libs,
+ f"ls -lanF {self.security_libs}",
"pam_tally2",
"faillock"
])
diff --git a/sos/report/plugins/pcp.py b/sos/report/plugins/pcp.py
index 3a08b546..c423b420 100644
--- a/sos/report/plugins/pcp.py
+++ b/sos/report/plugins/pcp.py
@@ -70,7 +70,7 @@ class Pcp(Plugin, RedHatPlugin, DebianPlugin):
else self.get_option("pmloggerfiles"))
if not self.pcp_parse_conffile():
- self._log_warn("could not parse %s" % self.pcp_conffile)
+ self._log_warn(f"could not parse {self.pcp_conffile}")
return
# Add PCP_SYSCONF_DIR (/etc/pcp) and PCP_VAR_DIR (/var/lib/pcp/config)
@@ -119,7 +119,7 @@ class Pcp(Plugin, RedHatPlugin, DebianPlugin):
files_collected = 0
path = self.path_join(self.pcp_log_dir, 'pmlogger',
self.pcp_hostname, '*')
- pmlogger_ls = self.exec_cmd("ls -t1 %s" % path)
+ pmlogger_ls = self.exec_cmd(f"ls -t1 {path}")
if pmlogger_ls['status'] == 0:
for line in pmlogger_ls['output'].splitlines():
self.add_copy_spec(line, sizelimit=0)
@@ -147,7 +147,7 @@ class Pcp(Plugin, RedHatPlugin, DebianPlugin):
if line.startswith(' pmlogger:'):
arc = line.split()[-1]
self.add_cmd_output(
- "pmstat -S 00:00 -T 23:59 -t 5m -x -a %s" % arc,
+ f"pmstat -S 00:00 -T 23:59 -t 5m -x -a {arc}",
root_symlink="pmstat"
)
break
diff --git a/sos/report/plugins/perccli.py b/sos/report/plugins/perccli.py
index ee155156..8c33e5fa 100644
--- a/sos/report/plugins/perccli.py
+++ b/sos/report/plugins/perccli.py
@@ -43,16 +43,16 @@ class PercCLI(Plugin, IndependentPlugin):
for subcmd in subcmds:
self.add_cmd_output(
- "%s %s%s" % (cmd, subcmd, json),
- suggest_filename="perccli64_%s%s" % (subcmd, json),
+ f"{cmd} {subcmd}{json}",
+ suggest_filename=f"perccli64_{subcmd}{json}",
runat=logpath)
# /call show events need 'file=' option to get adapter info like below
# "Adapter: # - Number of Events: xxx".
subcmd = '/call show events'
self.add_cmd_output(
- "%s %s file=/dev/stdout%s" % (cmd, subcmd, json),
- suggest_filename="perccli64_%s%s" % (subcmd, json),
+ f"{cmd} {subcmd} file=/dev/stdout{json}",
+ suggest_filename=f"perccli64_{subcmd}{json}",
runat=logpath)
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/peripety.py b/sos/report/plugins/peripety.py
index 4c1bf51a..887efdba 100644
--- a/sos/report/plugins/peripety.py
+++ b/sos/report/plugins/peripety.py
@@ -35,8 +35,8 @@ class Peripety(Plugin, RedHatPlugin):
for disk in disks:
self.add_cmd_output([
- "prpt info %s" % disk,
- "prpt query --blk %s" % disk
+ f"prpt info {disk}",
+ f"prpt query --blk {disk}",
])
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/podman.py b/sos/report/plugins/podman.py
index 7f15bcb4..0fab3285 100644
--- a/sos/report/plugins/podman.py
+++ b/sos/report/plugins/podman.py
@@ -73,7 +73,7 @@ class Podman(Plugin, RedHatPlugin, UbuntuPlugin):
'volume ls'
]
- self.add_cmd_output(["podman %s" % s for s in subcmds])
+ self.add_cmd_output([f"podman {s}" for s in subcmds])
# separately grab ps -s as this can take a *very* long time
if self.get_option('size'):
@@ -89,7 +89,7 @@ class Podman(Plugin, RedHatPlugin, UbuntuPlugin):
if pnets['status'] == 0:
nets = [pn.split()[0] for pn in pnets['output'].splitlines()[1:]]
self.add_cmd_output([
- "podman network inspect %s" % net for net in nets
+ f"podman network inspect {net}" for net in nets
], subdir='networks', tags='podman_network_inspect')
containers = [
@@ -100,24 +100,24 @@ class Podman(Plugin, RedHatPlugin, UbuntuPlugin):
volumes = self.get_container_volumes(runtime='podman')
for container in containers:
- self.add_cmd_output("podman inspect %s" % container,
+ self.add_cmd_output(f"podman inspect {container}",
subdir='containers',
tags='podman_container_inspect')
for img in images:
name, img_id = img
insp = name if 'none' not in name else img_id
- self.add_cmd_output("podman inspect %s" % insp, subdir='images',
+ self.add_cmd_output(f"podman inspect {insp}", subdir='images',
tags='podman_image_inspect')
for vol in volumes:
- self.add_cmd_output("podman volume inspect %s" % vol,
+ self.add_cmd_output(f"podman volume inspect {vol}",
subdir='volumes',
tags='podman_volume_inspect')
if self.get_option('logs'):
for con in containers:
- self.add_cmd_output("podman logs -t %s" % con,
+ self.add_cmd_output(f"podman logs -t {con}",
subdir='containers', priority=50)
def postproc(self):
diff --git a/sos/report/plugins/postgresql.py b/sos/report/plugins/postgresql.py
index 7e576ad0..2ee8307f 100644
--- a/sos/report/plugins/postgresql.py
+++ b/sos/report/plugins/postgresql.py
@@ -56,17 +56,13 @@ class PostgreSQL(Plugin):
os.environ["PGPASSWORD"] = self.get_option("password")
if self.get_option("dbhost"):
- cmd = "pg_dump -U %s -h %s -p %s -w -F t %s" % (
- self.get_option("username"),
- self.get_option("dbhost"),
- self.get_option("dbport"),
- self.get_option("dbname")
- )
+ cmd = (f"pg_dump -U {self.get_option('username')} "
+ f"-h {self.get_option('dbhost')} "
+ f"-p {self.get_option('dbport')} -w -F t "
+ f"{self.get_option('dbname')}")
else:
- cmd = "pg_dump -C -U %s -w -F t %s " % (
- self.get_option("username"),
- self.get_option("dbname")
- )
+ cmd = (f"pg_dump -C -U {self.get_option('username')} -w "
+ f"-F t {self.get_option('dbname')}")
self.add_cmd_output(cmd, suggest_filename=filename,
binary=True, sizelimit=0)
@@ -81,7 +77,7 @@ class PostgreSQL(Plugin):
def setup(self):
self.do_pg_dump()
- self.add_cmd_output("du -sh %s" % self.get_option('pghome'))
+ self.add_cmd_output(f"du -sh {self.get_option('pghome')}")
class RedHatPostgreSQL(PostgreSQL, RedHatPlugin):
diff --git a/sos/report/plugins/powerpc.py b/sos/report/plugins/powerpc.py
index 2d919181..46d001bc 100644
--- a/sos/report/plugins/powerpc.py
+++ b/sos/report/plugins/powerpc.py
@@ -90,7 +90,7 @@ class PowerPC(Plugin, IndependentPlugin):
"lparnumascore",
"lparnumascore -c cpu -d 4",
"lparnumascore -c mem -d 3",
- "ctsnap -xrunrpttr -d %s" % (ctsnap_path),
+ f"ctsnap -xrunrpttr -d {ctsnap_path}",
"lsdevinfo",
"lsslot",
"amsstat"
diff --git a/sos/report/plugins/process.py b/sos/report/plugins/process.py
index 4a0e9580..d478faf0 100644
--- a/sos/report/plugins/process.py
+++ b/sos/report/plugins/process.py
@@ -48,11 +48,11 @@ class Process(Plugin, IndependentPlugin):
for proc in procs:
self.add_copy_spec([
- "/proc/%s/status" % proc,
- "/proc/%s/cpuset" % proc,
- "/proc/%s/oom_*" % proc,
- "/proc/%s/stack" % proc,
- "/proc/%s/limits" % proc
+ f"/proc/{proc}/status",
+ f"/proc/{proc}/cpuset",
+ f"/proc/{proc}/oom_*",
+ f"/proc/{proc}/stack",
+ f"/proc/{proc}/limits",
])
if self.get_option("smaps"):
@@ -77,13 +77,14 @@ class Process(Plugin, IndependentPlugin):
], cmd_as_tag=True)
self.add_cmd_output([
- "%s %s" % (ps_axo, ps_group_opts),
- "%s %s" % (ps_axo, ps_sched_opts)
+ f"{ps_axo} {ps_group_opts}",
+ f"{ps_axo} {ps_sched_opts}",
])
if self.get_option("samples"):
- self.add_cmd_output("iotop -b -o -d 0.5 -t -n %s"
- % self.get_option("samples"), priority=100)
+ self.add_cmd_output("iotop -b -o -d 0.5 -t -n "
+ f"{self.get_option('samples')}",
+ priority=100)
self.add_cmd_output([
"pidstat -p ALL -rudvwsRU --human -h",
diff --git a/sos/report/plugins/processor.py b/sos/report/plugins/processor.py
index eb7b1a49..e8e1da48 100644
--- a/sos/report/plugins/processor.py
+++ b/sos/report/plugins/processor.py
@@ -23,13 +23,13 @@ class Processor(Plugin, IndependentPlugin):
cpupath = '/sys/devices/system/cpu'
self.add_file_tags({
- "%s/smt/control" % cpupath: 'cpu_smt_control',
- "%s/smt/active" % cpupath: 'cpu_smt_active',
- "%s/vulnerabilities/.*" % cpupath: 'cpu_vulns',
- "%s/vulnerabilities/spectre_v2" % cpupath: 'cpu_vulns_spectre_v2',
- "%s/vulnerabilities/meltdown" % cpupath: 'cpu_vulns_meltdown',
- "%s/cpu.*/online" % cpupath: 'cpu_cores',
- "%s/cpu/cpu0/cpufreq/cpuinfo_max_freq" % cpupath:
+ f"{cpupath}/smt/control": 'cpu_smt_control',
+ f"{cpupath}/smt/active": 'cpu_smt_active',
+ f"{cpupath}/vulnerabilities/.*": 'cpu_vulns',
+ f"{cpupath}/vulnerabilities/spectre_v2": 'cpu_vulns_spectre_v2',
+ f"{cpupath}/vulnerabilities/meltdown": 'cpu_vulns_meltdown',
+ f"{cpupath}/cpu.*/online": 'cpu_cores',
+ f"{cpupath}/cpu/cpu0/cpufreq/cpuinfo_max_freq":
'cpuinfo_max_freq'
})
diff --git a/sos/report/plugins/pulp.py b/sos/report/plugins/pulp.py
index d958e58a..a8a7c44f 100644
--- a/sos/report/plugins/pulp.py
+++ b/sos/report/plugins/pulp.py
@@ -54,9 +54,9 @@ class Pulp(Plugin, RedHatPlugin):
self.dbhost = uri[0]
self.dbport = uri[1]
if match(r"\s*username:\s+\S+", line):
- self.dbuser = "-u %s" % line.split()[1]
+ self.dbuser = f"-u {line.split()[1]}"
if match(r"\s*password:\s+\S+", line):
- self.dbpassword = "-p %s" % line.split()[1]
+ self.dbpassword = f"-p {line.split()[1]}"
if line.startswith("[messaging]"):
in_messaging_section = True
if in_messaging_section and line.startswith("certfile:"):
@@ -86,20 +86,20 @@ class Pulp(Plugin, RedHatPlugin):
num_tasks = self.get_option('tasks')
mtasks = self.build_mongo_cmd(
- '\"DBQuery.shellBatchSize=%s;; '
+ f'\"DBQuery.shellBatchSize={num_tasks};; '
'db.task_status.find().sort({finish_time: -1})'
- '.pretty().shellPrint()\"' % num_tasks
+ '.pretty().shellPrint()\"'
)
mres = self.build_mongo_cmd(
- '\"DBQuery.shellBatchSize=%s;; '
- 'db.reserved_resources.find().pretty().shellPrint()\"' % num_tasks
+ f'\"DBQuery.shellBatchSize={num_tasks};; '
+ 'db.reserved_resources.find().pretty().shellPrint()\"'
)
prun = self.build_mongo_cmd(
- r'"DBQuery.shellBatchSize=%s;; '
+ fr'"DBQuery.shellBatchSize={num_tasks};; '
r'db.task_status.find({state:{\$ne: \"finished\"}}).pretty()'
- r'.shellPrint()"' % num_tasks
+ r'.shellPrint()"'
)
# prints mongo collection sizes sorted from biggest and in human
@@ -150,8 +150,8 @@ class Pulp(Plugin, RedHatPlugin):
def build_mongo_cmd(self, query):
""" Build mongoDB command """
_cmd = "bash -c %s"
- _mondb = "--host %s --port %s %s %s" % (self.dbhost, self.dbport,
- self.dbuser, self.dbpassword)
+ _mondb = (f"--host {self.dbhost} --port {self.dbport} {self.dbuser} "
+ f"{self.dbpassword}")
_moncmd = "mongo pulp_database %s --eval %s"
return _cmd % quote(_moncmd % (_mondb, query))
diff --git a/sos/report/plugins/pulpcore.py b/sos/report/plugins/pulpcore.py
index 07b69546..3f9ce953 100644
--- a/sos/report/plugins/pulpcore.py
+++ b/sos/report/plugins/pulpcore.py
@@ -100,14 +100,14 @@ class PulpCore(Plugin, IndependentPlugin):
"DJANGO_SETTINGS_MODULE": "pulpcore.app.settings"}
self.add_cmd_output("dynaconf list", env=dynaconf_env)
for _dir in [self.staticroot, self.uploaddir]:
- self.add_cmd_output("ls -l %s" % _dir)
+ self.add_cmd_output(f"ls -l {_dir}")
task_days = self.get_option('task-days')
for table in ['core_task', 'core_taskgroup',
'core_groupprogressreport', 'core_progressreport']:
- _query = "select * from %s where pulp_last_updated > NOW() - " \
- "interval '%s days' order by pulp_last_updated" % \
- (table, task_days)
+ _query = (f"select * from {table} where pulp_last_updated > NOW()"
+ f" - interval '{task_days} days' order by"
+ " pulp_last_updated")
_cmd = self.build_query_cmd(_query)
self.add_cmd_output(_cmd, env=self.env, suggest_filename=table)
@@ -139,8 +139,8 @@ class PulpCore(Plugin, IndependentPlugin):
a large amount of quoting in sos logs referencing the command being run
"""
if csv:
- query = "COPY (%s) TO STDOUT " \
- "WITH (FORMAT 'csv', DELIMITER ',', HEADER)" % query
+ query = f"COPY ({query}) TO STDOUT " \
+ "WITH (FORMAT 'csv', DELIMITER ',', HEADER)"
_dbcmd = "psql --no-password -h %s -p %s -U pulp -d %s -c %s"
return _dbcmd % (self.dbhost, self.dbport, self.dbname, quote(query))
diff --git a/sos/report/plugins/puppet.py b/sos/report/plugins/puppet.py
index 01763598..9a69ed14 100644
--- a/sos/report/plugins/puppet.py
+++ b/sos/report/plugins/puppet.py
@@ -56,7 +56,7 @@ class Puppet(Plugin, IndependentPlugin):
self.do_file_sub(
device_conf,
r"(.*url*.ssh://.*:).*(@.*)",
- r"\1%s\2" % ('***')
+ r"\1***\2"
)
# vim: et ts=4 sw=4
diff --git a/sos/report/plugins/python.py b/sos/report/plugins/python.py
index 0d151247..36ff556a 100644
--- a/sos/report/plugins/python.py
+++ b/sos/report/plugins/python.py
@@ -40,7 +40,7 @@ class Python(Plugin):
# pip: /usr/bin/pip2.7 /usr/bin/pip3.6
# where we must skip the first word
for pip in pips['output'].split()[1:]:
- self.add_cmd_output("%s list installed" % pip)
+ self.add_cmd_output(f"{pip} list installed")
class UbuntuPython(Python, DebianPlugin, UbuntuPlugin):
@@ -106,8 +106,8 @@ class RedHatPython(Python, RedHatPlugin):
'sha256': digest
})
except IOError:
- self._log_error("Unable to read python file at %s"
- % filepath)
+ self._log_error("Unable to read python file at "
+ f"{filepath}")
return digests
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/qaucli.py b/sos/report/plugins/qaucli.py
index 2d7db52d..5e4c03b2 100644
--- a/sos/report/plugins/qaucli.py
+++ b/sos/report/plugins/qaucli.py
@@ -23,11 +23,11 @@ class Qaucli(Plugin, IndependentPlugin):
for subcmd in subcmds:
self.add_cmd_output(
- "%s %s" % (cmd, subcmd),
- suggest_filename="qaucli_%s" % subcmd)
+ f"{cmd} {subcmd}",
+ suggest_filename=f"qaucli_{subcmd}")
result = self.collect_cmd_output(
- "%s -i" % cmd,
+ f"{cmd} -i",
suggest_filename="qaucli_-i")
if result['status'] == 0:
@@ -35,7 +35,7 @@ class Qaucli(Plugin, IndependentPlugin):
if "HBA Instance" in line:
hba = line.split(':')[1].strip()
self.add_cmd_output(
- "%s -l %s" % (cmd, hba),
- suggest_filename="qaucli_-l_%s" % hba)
+ f"{cmd} -l {hba}",
+ suggest_filename=f"qaucli_-l_{hba}")
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/qpid.py b/sos/report/plugins/qpid.py
index 2e65ea5b..40dd3af2 100644
--- a/sos/report/plugins/qpid.py
+++ b/sos/report/plugins/qpid.py
@@ -37,11 +37,10 @@ class Qpid(Plugin, RedHatPlugin):
for option in ["ssl-certificate", "ssl-key"]:
if self.get_option(option):
amqps_prefix = "amqps://"
- options = (options + " --%s=" % (option) +
- self.get_option(option))
+ options = (options + f" --{option}={self.get_option(option)}")
if self.get_option("port"):
options = (options + " -b " + amqps_prefix +
- "localhost:%s" % (self.get_option("port")))
+ f"localhost:{self.get_option('port')}")
self.add_cmd_output([
"qpid-stat -g" + options, # applies since 0.18 version
diff --git a/sos/report/plugins/qpid_dispatch.py b/sos/report/plugins/qpid_dispatch.py
index f6f11f27..3c554896 100644
--- a/sos/report/plugins/qpid_dispatch.py
+++ b/sos/report/plugins/qpid_dispatch.py
@@ -36,13 +36,13 @@ class QpidDispatch(Plugin, RedHatPlugin):
options = ""
if self.get_option("port"):
options = (options + " -b " + gethostname() +
- ":%s" % (self.get_option("port")))
+ f":{self.get_option('port')}")
# gethostname() is due to DISPATCH-156
# for either present option, add --option=value to 'options' variable
for option in ["ssl-certificate", "ssl-key", "ssl-trustfile"]:
if self.get_option(option):
- options = (options + " --%s=" % (option) +
+ options = (options + f" --{option}=" +
self.get_option(option))
self.add_cmd_output([
diff --git a/sos/report/plugins/rasdaemon.py b/sos/report/plugins/rasdaemon.py
index aab87e16..84a0db6c 100644
--- a/sos/report/plugins/rasdaemon.py
+++ b/sos/report/plugins/rasdaemon.py
@@ -29,6 +29,6 @@ class Rasdaemon(Plugin, RedHatPlugin):
'--status',
'--summary'
]
- self.add_cmd_output(["ras-mc-ctl %s" % sub for sub in subcmds])
+ self.add_cmd_output([f"ras-mc-ctl {sub}" for sub in subcmds])
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/rhui.py b/sos/report/plugins/rhui.py
index 230b2130..465c4719 100644
--- a/sos/report/plugins/rhui.py
+++ b/sos/report/plugins/rhui.py
@@ -56,7 +56,7 @@ class Rhui(Plugin, RedHatPlugin):
for cookie in ["csrftoken", "sessionid"]:
self.do_path_regex_sub(
r"/root/\.rhui/.*/cookies.txt",
- r"(%s\s+)(\S+)" % cookie,
+ fr"({cookie}\s+)(\S+)",
r"\1********")
diff --git a/sos/report/plugins/rpm.py b/sos/report/plugins/rpm.py
index 25a06c09..1e4caeef 100644
--- a/sos/report/plugins/rpm.py
+++ b/sos/report/plugins/rpm.py
@@ -33,7 +33,7 @@ class Rpm(Plugin, RedHatPlugin):
rpmq = "rpm --nodigest -qa --qf=%s"
# basic installed-rpms
nvra = '"%-59{NVRA} %{INSTALLTIME:date}\n"'
- irpms = "sh -c '%s | sort -V'" % rpmq % nvra
+ irpms = f"sh -c '{rpmq} | sort -V'" % nvra
self.add_cmd_output(irpms, root_symlink='installed-rpms',
tags='installed_rpms')
diff --git a/sos/report/plugins/rpmostree.py b/sos/report/plugins/rpmostree.py
index 371bf648..66c876cc 100644
--- a/sos/report/plugins/rpmostree.py
+++ b/sos/report/plugins/rpmostree.py
@@ -29,7 +29,7 @@ class Rpmostree(Plugin, RedHatPlugin):
'--version'
]
- self.add_cmd_output(["rpm-ostree %s" % subcmd for subcmd in subcmds])
+ self.add_cmd_output([f"rpm-ostree {subcmd}" for subcmd in subcmds])
units = [
'rpm-ostreed',
diff --git a/sos/report/plugins/s390.py b/sos/report/plugins/s390.py
index 4f39af38..0cf4fb8b 100644
--- a/sos/report/plugins/s390.py
+++ b/sos/report/plugins/s390.py
@@ -72,8 +72,8 @@ class S390(Plugin, IndependentPlugin):
dasd_dev = ret['output']
for dev in dasd_dev.split('\n'):
self.add_cmd_output([
- "dasdview -x -i -j -l -f %s" % (dev,),
- "fdasd -p %s" % (dev,)
+ f"dasdview -x -i -j -l -f {dev}",
+ f"fdasd -p {dev}",
])
diff --git a/sos/report/plugins/saphana.py b/sos/report/plugins/saphana.py
index 8e1e8b62..742467ff 100644
--- a/sos/report/plugins/saphana.py
+++ b/sos/report/plugins/saphana.py
@@ -28,24 +28,24 @@ class Saphana(Plugin, RedHatPlugin):
sids.append(sid)
for sid in sids:
- sidadm = '%sadm' % sid.lower()
- prefix = 'su - %s -c' % sidadm
+ sidadm = f'{sid.lower()}adm'
+ prefix = f'su - {sidadm} -c'
- self.add_cmd_output('%s "HDB info"' % prefix,
- suggest_filename="%s_HDB_info" % sid)
+ self.add_cmd_output(f'{prefix} "HDB info"',
+ suggest_filename=f"{sid}_HDB_info")
- self.add_cmd_output('%s "hdbsrvutil -v"' % prefix,
- suggest_filename="%s_version" % sid)
+ self.add_cmd_output(f'{prefix} "hdbsrvutil -v"',
+ suggest_filename=f"{sid}_version")
- self.add_cmd_output('%s \'hdbcons "mm l -s -S -p"\'' % prefix,
- suggest_filename="%s_memusage" % sid)
+ self.add_cmd_output(f'{prefix} \'hdbcons "mm l -s -S -p"\'',
+ suggest_filename=f"{sid}_memusage")
- self.add_cmd_output('%s \'hdbcons -e hdbindexserver \
- "replication info"\'' % prefix,
- suggest_filename="%s_replicainfo" % sid)
+ self.add_cmd_output(f'{prefix} \'hdbcons -e hdbindexserver \
+ "replication info"\'',
+ suggest_filename=f"{sid}_replicainfo")
- if self.path_isdir("/hana/shared/%s/" % sid):
- for inst in self.listdir("/hana/shared/%s/" % sid):
+ if self.path_isdir(f"/hana/shared/{sid}/"):
+ for inst in self.listdir(f"/hana/shared/{sid}/"):
if "HDB" in inst:
inst = inst.strip()[-2:]
self.get_inst_info(sid, sidadm, inst)
@@ -53,16 +53,16 @@ class Saphana(Plugin, RedHatPlugin):
def get_inst_info(self, sid, sidadm, inst):
""" Collect the given instance info """
proc_cmd = 'su - %s -c "sapcontrol -nr %s -function GetProcessList"'
- status_fname = "%s_%s_status" % (sid, inst)
+ status_fname = f"{sid}_{inst}_status"
self.add_cmd_output(
proc_cmd % (sidadm, inst),
suggest_filename=status_fname
)
- path = "/usr/sap/%s/HDB%s/exe/python_support" % (sid, inst)
+ path = f"/usr/sap/{sid}/HDB{inst}/exe/python_support"
if self.path_isdir(path):
py_cmd = 'su - %s -c "python %s/landscapeHostConfiguration.py"'
- py_fname = "%s_%s_landscapeConfig" % (sid, inst)
+ py_fname = f"{sid}_{inst}_landscapeConfig"
self.add_cmd_output(
py_cmd % (sidadm, path),
suggest_filename=py_fname
diff --git a/sos/report/plugins/sapnw.py b/sos/report/plugins/sapnw.py
index 23af0a8f..f0343b0a 100644
--- a/sos/report/plugins/sapnw.py
+++ b/sos/report/plugins/sapnw.py
@@ -38,54 +38,50 @@ class Sapnw(Plugin, RedHatPlugin):
inst = fields[5]
vhost = fields[7]
sidsunique.add(sid)
- path = "/usr/sap/%s/SYS/profile/" % sid
+ path = f"/usr/sap/{sid}/SYS/profile/"
if not self.path_exists(path):
continue
for line in self.listdir(path):
if all(f in line for f in [sid, inst, vhost]):
- ldenv = 'LD_LIBRARY_PATH=/usr/sap/%s/SYS/exe/run' % sid
+ ldenv = f'LD_LIBRARY_PATH=/usr/sap/{sid}/SYS/exe/run'
# Unicode is assumed here
# nuc should be accounted
- path = '/usr/sap/%s/SYS/exe/uc/linuxx86_64' % sid
+ path = f'/usr/sap/{sid}/SYS/exe/uc/linuxx86_64'
profile = line.strip()
# collect profiles
self.add_cmd_output(
- "env -i %s %s/sappfpar all "
- "pf=/usr/sap/%s/SYS/profile/%s" %
- (ldenv, path, sid, profile),
- suggest_filename="%s_parameters" % profile
+ f"env -i {ldenv} {path}/sappfpar all "
+ f"pf=/usr/sap/{sid}/SYS/profile/{profile}",
+ suggest_filename=f"{profile}_parameters"
)
# collect instance status
self.add_cmd_output(
- "env -i %s %s/sapcontrol -nr %s "
- "-function GetProcessList"
- % (ldenv, path, inst),
- suggest_filename="%s_%s_GetProcList" % (sid, inst)
+ f"env -i {ldenv} {path}/sapcontrol -nr {inst} "
+ "-function GetProcessList",
+ suggest_filename=f"{sid}_{inst}_GetProcList"
)
# collect version info for the various components
self.add_cmd_output(
- "env -i %s %s/sapcontrol -nr %s "
- "-function GetVersionInfo"
- % (ldenv, path, inst),
- suggest_filename="%s_%s_GetVersInfo" % (sid, inst)
+ f"env -i {ldenv} {path}/sapcontrol -nr {inst} "
+ "-function GetVersionInfo",
+ suggest_filename=f"{sid}_{inst}_GetVersInfo"
)
# collect <SID>adm user environment
lowsid = sid.lower()
- fname = "%s_%sadm_%s_userenv" % (sid, lowsid, inst)
+ fname = f"{sid}_{lowsid}adm_{inst}_userenv"
self.add_cmd_output(
- 'su - %sadm -c "sapcontrol -nr %s '
- '-function GetEnvironment"'
- % (lowsid, inst),
+ f'su - {lowsid}adm -c "sapcontrol -nr {inst} '
+ '-function GetEnvironment"',
suggest_filename=fname
)
# traverse the sids list, collecting info about dbclient
for sid in sidsunique:
- self.add_copy_spec("/usr/sap/%s/*DVEB*/work/dev_w0" % sid)
+ self.add_copy_spec(f"/usr/sap/{sid}/*DVEB*/work/dev_w0")
def collect_list_dbs(self):
""" Collect data all the installed DBs """
@@ -108,26 +104,26 @@ class Sapnw(Plugin, RedHatPlugin):
if dbtype == 'db6':
# IBM DB2
self.add_cmd_output(
- "su - %s -c \"db2 get dbm cfg\"" % dbadm,
- suggest_filename="%s_%s_db2_info" % (sid, dbadm)
+ f"su - {dbadm} -c \"db2 get dbm cfg\"",
+ suggest_filename=f"{sid}_{dbadm}_db2_info"
)
elif dbtype == 'sap':
# SAP MAXDB
sid = fields[2][:-1]
self.add_copy_spec(
- "/sapdb/%s/data/config/%s.pah" % (sid, sid)
+ f"/sapdb/{sid}/data/config/{sid}.pah"
)
elif dbtype == 'ora':
# Oracle
sid = fields[2][:-1]
- self.add_copy_spec("/oracle/%s/*/dbs/init.ora" % sid)
+ self.add_copy_spec(f"/oracle/{sid}/*/dbs/init.ora")
elif dbtype == 'syb':
# Sybase
sid = fields[2][:-1]
- self.add_copy_spec("/sybase/%s/ASE*/%s.cfg" % (sid, sid))
+ self.add_copy_spec(f"/sybase/{sid}/ASE*/{sid}.cfg")
def setup(self):
self.collect_list_instances()
diff --git a/sos/report/plugins/sar.py b/sos/report/plugins/sar.py
index fdf2a3c6..5721256f 100644
--- a/sos/report/plugins/sar.py
+++ b/sos/report/plugins/sar.py
@@ -58,7 +58,7 @@ class Sar(Plugin):
try:
dir_list = self.listdir(self.sa_path)
except OSError:
- self._log_warn("sar: could not list %s" % self.sa_path)
+ self._log_warn(f"sar: could not list {self.sa_path}")
return
sa_regex = re.compile(r"sa[\d]+")
# find all the sa files that don't have an existing sar file
@@ -75,10 +75,10 @@ class Sar(Plugin):
if not self.get_option('all_sar') and \
self.is_older_than_7days(sa_data_path):
continue
- sar_cmd = "sar -A -f %s" % sa_data_path
+ sar_cmd = f"sar -A -f {sa_data_path}"
self.add_cmd_output(sar_cmd, sar_filename)
- sadf_cmd = "sadf -x -- -A %s" % sa_data_path
- self.add_cmd_output(sadf_cmd, "%s.xml" % fname)
+ sadf_cmd = f"sadf -x -- -A {sa_data_path}"
+ self.add_cmd_output(sadf_cmd, f"{fname}.xml")
def is_older_than_7days(self, sarfile):
""" Is the file older than 7 days? """
@@ -88,8 +88,8 @@ class Sar(Plugin):
if _age.days <= 7:
return False
except Exception as err: # pylint: disable=broad-except
- self._log_warn("Could not determine age of '%s' - skipping "
- "converting to sar format: %s" % (sarfile, err))
+ self._log_warn(f"Could not determine age of '{sarfile}' - "
+ f"skipping converting to sar format: {err}")
return True
diff --git a/sos/report/plugins/sas3ircu.py b/sos/report/plugins/sas3ircu.py
index bacb215a..fe7c292a 100644
--- a/sos/report/plugins/sas3ircu.py
+++ b/sos/report/plugins/sas3ircu.py
@@ -32,7 +32,7 @@ class SAS3ircu(Plugin, IndependentPlugin):
# for each adapter get some basic info
for sas_info in sas_lst:
sas_num = sas_info.split()[0]
- self.add_cmd_output("sas3ircu %s display" % sas_num, timeout=5)
- self.add_cmd_output("sas3ircu %s status" % sas_num, timeout=5)
+ self.add_cmd_output(f"sas3ircu {sas_num} display", timeout=5)
+ self.add_cmd_output(f"sas3ircu {sas_num} status", timeout=5)
# vim: et ts=4 sw=4
diff --git a/sos/report/plugins/scsi.py b/sos/report/plugins/scsi.py
index 2d75217f..553f8b57 100644
--- a/sos/report/plugins/scsi.py
+++ b/sos/report/plugins/scsi.py
@@ -45,7 +45,7 @@ class Scsi(Plugin, IndependentPlugin):
for line in result['output'].splitlines():
if line.split()[1] in scsi_types:
devsg = line.split()[-1]
- self.add_cmd_output("sg_ses -p2 -b1 %s" % devsg)
+ self.add_cmd_output(f"sg_ses -p2 -b1 {devsg}")
self.add_cmd_output("lsscsi -i", suggest_filename="lsscsi",
tags="lsscsi")
diff --git a/sos/report/plugins/seagate_ses.py b/sos/report/plugins/seagate_ses.py
index f3fd24db..7eb4d849 100644
--- a/sos/report/plugins/seagate_ses.py
+++ b/sos/report/plugins/seagate_ses.py
@@ -59,11 +59,11 @@ class SeagateSES(Plugin, IndependentPlugin):
for devid in devices:
self.add_cmd_output([
- "%s %d -CLI %s" % (cmd, devid, subcmd) for subcmd in subcmds
+ f"{cmd} {devid} -CLI {subcmd}" for subcmd in subcmds
])
self.add_cmd_output([
- "%s %d -cli %s" % (cmd, devid, subcmd) for subcmd in subcmds
+ f"{cmd} {devid} -cli {subcmd}" for subcmd in subcmds
])
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/selinux.py b/sos/report/plugins/selinux.py
index e344ef9f..8a185637 100644
--- a/sos/report/plugins/selinux.py
+++ b/sos/report/plugins/selinux.py
@@ -55,7 +55,7 @@ class SELinux(Plugin, RedHatPlugin, UbuntuPlugin):
]
for subcmd in subcmds:
- self.add_cmd_output("semanage %s -l" % subcmd)
+ self.add_cmd_output(f"semanage {subcmd} -l")
if self.get_option('fixfiles'):
self.add_cmd_output("restorecon -Rvn /", stderr=False,
diff --git a/sos/report/plugins/shmcli.py b/sos/report/plugins/shmcli.py
index ad8743b4..e0e2b18e 100644
--- a/sos/report/plugins/shmcli.py
+++ b/sos/report/plugins/shmcli.py
@@ -39,8 +39,8 @@ class SHMcli(Plugin, IndependentPlugin):
for subcmd in subcmds:
self.add_cmd_output(
- "%s %s" % (self.shmcli_bin, subcmd),
- suggest_filename="shmcli_%s" % (subcmd))
+ f"{self.shmcli_bin} {subcmd}",
+ suggest_filename=f"shmcli_{subcmd}")
self.collect_enclosures_list()
self.collect_drivers_list()
@@ -72,7 +72,7 @@ class SHMcli(Plugin, IndependentPlugin):
]
result = self.collect_cmd_output(
- '%s list enclosures' % (self.shmcli_bin),
+ f'{self.shmcli_bin} list enclosures',
suggest_filename='shmcli_list_enclosures'
)
if result['status'] == 0:
@@ -82,17 +82,16 @@ class SHMcli(Plugin, IndependentPlugin):
adapt_index = line[-1]
enc_index = line[0]
for subcmd in subcmds:
- _cmd = ("%s %s -a=%s -enc=%s"
- % (self.shmcli_bin, subcmd,
- adapt_index, enc_index))
+ _cmd = (f"{self.shmcli_bin} {subcmd} -a={adapt_index}"
+ f" -enc={enc_index}")
_fname = _cmd.replace(self.shmcli_bin, 'shmcli')
self.add_cmd_output(_cmd, suggest_filename=_fname)
if self.get_option('debug'):
logpath = self.get_cmd_output_path(make=False)
- _dcmd = ("%s getdebugcli -a=%s -enc=%s"
- % (self.shmcli_bin, adapt_index, enc_index))
+ _dcmd = (f"{self.shmcli_bin} getdebugcli "
+ f"-a={adapt_index} -enc={enc_index}")
_dname = _dcmd.replace(self.shmcli_bin, 'shmcli')
- _odir = (" -outputdir=%s" % (logpath))
+ _odir = (f" -outputdir={logpath}")
self.add_cmd_output(
_dcmd + _odir, suggest_filename=_dname,
timeout=300
@@ -101,7 +100,7 @@ class SHMcli(Plugin, IndependentPlugin):
def collect_drivers_list(self):
""" Collect info on the drives """
result = self.collect_cmd_output(
- '%s list drives' % (self.shmcli_bin),
+ f'{self.shmcli_bin} list drives',
suggest_filename='shmcli_list_drives'
)
if result['status'] == 0:
@@ -109,8 +108,7 @@ class SHMcli(Plugin, IndependentPlugin):
words = line.split()
if len(words) > 6:
if (words[0] not in ['WWN', '---']):
- _cmd = ("%s info drive -d=%s"
- % (self.shmcli_bin, words[0]))
+ _cmd = f"{self.shmcli_bin} info drive -d={words[0]}"
_fname = _cmd.replace(self.shmcli_bin, 'shmcli')
self.add_cmd_output(_cmd, suggest_filename=_fname)
diff --git a/sos/report/plugins/slurm.py b/sos/report/plugins/slurm.py
index 1a6437ea..7e064446 100644
--- a/sos/report/plugins/slurm.py
+++ b/sos/report/plugins/slurm.py
@@ -98,8 +98,8 @@ class Slurm(Plugin, UbuntuPlugin, RedHatPlugin):
if words[0].strip() == 'SlurmctldLogFile':
slurmctld_log_file = words[1].strip()
except IOError as error:
- self._log_error('Could not open conf file %s: %s' %
- (config_file, error))
+ self._log_error(f'Could not open conf file {config_file}:'
+ f' {error}')
if not self.get_option("all_logs"):
self.add_copy_spec([
@@ -122,7 +122,7 @@ class Slurm(Plugin, UbuntuPlugin, RedHatPlugin):
'AccountingStoragePass',
'JobCompPass',
]
- slurm_keys_regex = r"(^\s*(%s)\s*=\s*)(.*)" % "|".join(slurm_keys)
+ slurm_keys_regex = fr"(^\s*({'|'.join(slurm_keys)})\s*=\s*)(.*)"
slurmdbd_key_regex = r'(^\s*(StoragePass)\s*=\s*)(.*)'
sub = r'\1********'
diff --git a/sos/report/plugins/smclient.py b/sos/report/plugins/smclient.py
index bf94ac18..877aaed1 100644
--- a/sos/report/plugins/smclient.py
+++ b/sos/report/plugins/smclient.py
@@ -41,7 +41,7 @@ class SMcli(Plugin, IndependentPlugin):
# Collect status of each storage array
for ssname in ssnames:
self.add_cmd_output([
- "SMcli localhost -n %s -c '%s'" % (ssname, subcmd)
+ f"SMcli localhost -n {ssname} -c '{subcmd}'"
for subcmd in subcmds
])
@@ -56,7 +56,7 @@ class SMcli(Plugin, IndependentPlugin):
subcmd = 'save storageArray supportData file='
for ssname in ssnames:
self.add_cmd_output(
- "%s %s -c '%s\"support-%s\";'" % (cmd, ssname, subcmd, ssname),
+ f"{cmd} {ssname} -c '{subcmd}\"support-{ssname}\";'",
runat=logpath, timeout=450)
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/sos_extras.py b/sos/report/plugins/sos_extras.py
index 02481c69..7ccbadcd 100644
--- a/sos/report/plugins/sos_extras.py
+++ b/sos/report/plugins/sos_extras.py
@@ -48,18 +48,18 @@ class SosExtras(Plugin, IndependentPlugin):
st_res = os.stat(self.extras_dir)
if (st_res.st_uid != 0) or (st_res.st_mode & stat.S_IWGRP) or \
(st_res.st_mode & stat.S_IWOTH):
- self._log_warn("Skipping sos extras as %s has too wide"
- " permissions or ownership." % self.extras_dir)
+ self._log_warn(f"Skipping sos extras as {self.extras_dir} has"
+ " too wide permissions or ownership.")
return
except OSError:
- self._log_warn("can't stat %s, skipping sos extras" %
- self.extras_dir)
+ self._log_warn(f"can't stat {self.extras_dir}, skipping sos"
+ " extras")
return
for path, _, filelist in os.walk(self.extras_dir):
for file in filelist:
_file = self.path_join(path, file)
- self._log_warn("Collecting data from extras file %s" % _file)
+ self._log_warn(f"Collecting data from extras file {_file}")
try:
with open(_file, 'r', encoding='UTF-8') as sfile:
for line in sfile.read().splitlines():
@@ -86,6 +86,6 @@ class SosExtras(Plugin, IndependentPlugin):
self.add_cmd_output(line, subdir=file)
except IOError:
- self._log_warn("unable to read extras file %s" % _file)
+ self._log_warn(f"unable to read extras file {_file}")
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/storcli.py b/sos/report/plugins/storcli.py
index bdb94fb2..acc945d9 100644
--- a/sos/report/plugins/storcli.py
+++ b/sos/report/plugins/storcli.py
@@ -43,16 +43,16 @@ class StorCLI(Plugin, IndependentPlugin):
for subcmd in subcmds:
self.add_cmd_output(
- "%s %s%s" % (cmd, subcmd, json),
- suggest_filename="storcli64_%s%s" % (subcmd, json),
+ f"{cmd} {subcmd}{json}",
+ suggest_filename=f"storcli64_{subcmd}{json}",
runat=logpath)
# /call show events need 'file=' option to get adapter info like below
# "Adapter: # - Number of Events: xxx".
subcmd = '/call show events'
self.add_cmd_output(
- "%s %s file=/dev/stdout%s" % (cmd, subcmd, json),
- suggest_filename="storcli64_%s%s" % (subcmd, json),
+ f"{cmd} {subcmd} file=/dev/stdout{json}",
+ suggest_filename=f"storcli64_{subcmd}{json}",
runat=logpath)
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/stratis.py b/sos/report/plugins/stratis.py
index de0a7150..621abc24 100644
--- a/sos/report/plugins/stratis.py
+++ b/sos/report/plugins/stratis.py
@@ -33,6 +33,6 @@ class Stratis(Plugin, RedHatPlugin):
'--version',
]
- self.add_cmd_output(["stratis %s" % subcmd for subcmd in subcmds])
+ self.add_cmd_output([f"stratis {subcmd}" for subcmd in subcmds])
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/subscription_manager.py b/sos/report/plugins/subscription_manager.py
index a2e4485a..a37886c8 100644
--- a/sos/report/plugins/subscription_manager.py
+++ b/sos/report/plugins/subscription_manager.py
@@ -30,14 +30,13 @@ class SubscriptionManager(Plugin, RedHatPlugin):
proxy_port = config.get('server', 'proxy_port')
if proxy_port:
proxy_port = ":" + proxy_port
- proxy = "--proxy %s://%s%s" % (proxy_scheme, proxy_hostname,
- proxy_port)
+ proxy = f"--proxy {proxy_scheme}://{proxy_hostname}{proxy_port}"
proxy_user = config.get('server', 'proxy_user')
if proxy and proxy_user:
- proxy += " --proxy-user %s" % proxy_user
+ proxy += f" --proxy-user {proxy_user}"
proxy_password = config.get('server', 'proxy_password')
if proxy_password:
- proxy += ":%s" % proxy_password
+ proxy += f":{proxy_password}"
return proxy
def get_server_url(self, config):
@@ -47,8 +46,8 @@ class SubscriptionManager(Plugin, RedHatPlugin):
# if port is set, prepend it by ':' separating it from hostname
if len(port) > 0:
port = ":" + port
- return "http%s://%s%s%s" % (secure, config.get('server', 'hostname'),
- port, config.get('server', 'prefix'))
+ return (f"http{secure}://{config.get('server', 'hostname')}{port}"
+ f"{config.get('server', 'prefix')}")
def setup(self):
# rhsm config and logs
@@ -73,11 +72,11 @@ class SubscriptionManager(Plugin, RedHatPlugin):
"subscription-manager status",
], cmd_as_tag=True)
self.add_cmd_output("rhsm-debug system --sos --no-archive "
- "--no-subscriptions --destination %s"
- % self.get_cmd_output_path())
+ "--no-subscriptions --destination "
+ f"{self.get_cmd_output_path()}")
certs = glob.glob('/etc/pki/product-default/*.pem')
- self.add_cmd_output(["rct cat-cert %s" % cert for cert in certs],
+ self.add_cmd_output([f"rct cat-cert {cert}" for cert in certs],
tags='subscription_manager_installed_product_ids')
# try curl to the RHSM server for potential certificate/proxy issue
@@ -89,10 +88,8 @@ class SubscriptionManager(Plugin, RedHatPlugin):
config = get_config_parser()
proxy = self.get_proxy_string(config)
server_url = self.get_server_url(config)
- curlcmd = "curl -vv %s --cacert %s %s" % \
- (server_url,
- config.get('rhsm', 'repo_ca_cert'),
- proxy)
+ curlcmd = (f"curl -vv {server_url} --cacert "
+ f"{config.get('rhsm', 'repo_ca_cert')} {proxy}")
# honour os.environ no_proxy, if set
no_proxy = config.get('server', 'no_proxy')
if no_proxy:
diff --git a/sos/report/plugins/tomcat.py b/sos/report/plugins/tomcat.py
index 82f148f0..0ffaf28c 100644
--- a/sos/report/plugins/tomcat.py
+++ b/sos/report/plugins/tomcat.py
@@ -33,7 +33,7 @@ class Tomcat(Plugin, RedHatPlugin):
# get today's date in iso format so that days/months below 10
# prepend 0
today = datetime.date(datetime.now()).isoformat()
- log_glob = "/var/log/tomcat*/catalina.%s.log" % today
+ log_glob = f"/var/log/tomcat*/catalina.{today}.log"
self.add_copy_spec(log_glob)
else:
self.add_copy_spec("/var/log/tomcat*/*")
@@ -49,7 +49,7 @@ class Tomcat(Plugin, RedHatPlugin):
'truststorePass', 'SSLPassword']
self.do_path_regex_sub(
r"\/etc\/tomcat.*\/server.xml",
- r"(%s)=(\S*)" % "|".join(server_password_attr),
+ fr"({'|'.join(server_password_attr)})=(\S*)",
r'\1="********"'
)
self.do_path_regex_sub(
diff --git a/sos/report/plugins/ubuntu.py b/sos/report/plugins/ubuntu.py
index a6b1d6d3..6706bf24 100644
--- a/sos/report/plugins/ubuntu.py
+++ b/sos/report/plugins/ubuntu.py
@@ -33,7 +33,7 @@ class Ubuntu(Plugin, UbuntuPlugin):
ua_pred = SoSPredicate(self, kmods=['tls'])
self.add_cmd_output(ua_tools_status,
pred=ua_pred, changes=True)
- self.add_cmd_output("%s --format json" % ua_tools_status,
+ self.add_cmd_output(f"{ua_tools_status} --format json",
pred=ua_pred, changes=True)
if not self.get_option("all_logs"):
diff --git a/sos/report/plugins/ultrapath.py b/sos/report/plugins/ultrapath.py
index 2fd8735c..8e045fbd 100644
--- a/sos/report/plugins/ultrapath.py
+++ b/sos/report/plugins/ultrapath.py
@@ -34,7 +34,7 @@ class UltraPath(Plugin, RedHatPlugin):
if result['status'] == 0:
for line in result['output'].splitlines():
if line.startswith("Array ID :"):
- self.add_cmd_output("upadm show lun array=%s" %
- line.split(':')[1].strip())
+ self.add_cmd_output(f"upadm show lun "
+ f"array={line.split(':')[1].strip()}")
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/vault.py b/sos/report/plugins/vault.py
index 7438c4c9..d40031ee 100644
--- a/sos/report/plugins/vault.py
+++ b/sos/report/plugins/vault.py
@@ -42,8 +42,7 @@ class Vault(Plugin, UbuntuPlugin):
self.add_cmd_output("vault status",
env={'VAULT_ADDR': api_addr})
except IOError as error:
- self._log_error('Could not open conf file %s: %s' %
- (vault_cfg, error))
+ self._log_error(f'Could not open conf file {vault_cfg}: {error}')
def postproc(self):
self.do_file_sub(
diff --git a/sos/report/plugins/vdo.py b/sos/report/plugins/vdo.py
index f4f4cef1..f98af39f 100644
--- a/sos/report/plugins/vdo.py
+++ b/sos/report/plugins/vdo.py
@@ -27,7 +27,7 @@ class Vdo(Plugin, RedHatPlugin):
self.add_copy_spec(self.files)
vdos = self.collect_cmd_output('vdo list --all')
for vdo in vdos['output'].splitlines():
- self.add_cmd_output("vdo status -n %s" % vdo)
+ self.add_cmd_output(f"vdo status -n {vdo}")
self.add_cmd_output('vdostats --human-readable')
# vim set et ts=4 sw=4 :
diff --git a/sos/report/plugins/vdsm.py b/sos/report/plugins/vdsm.py
index ad5ee702..a4582e6e 100644
--- a/sos/report/plugins/vdsm.py
+++ b/sos/report/plugins/vdsm.py
@@ -94,7 +94,7 @@ class Vdsm(Plugin, RedHatPlugin):
if qemu_pids:
files = ["cmdline", "status", "mountstats"]
self.add_copy_spec([
- "/proc/%s/%s" % (pid, name)
+ f"/proc/{pid}/{name}"
for pid in qemu_pids
for name in files
])
@@ -104,9 +104,9 @@ class Vdsm(Plugin, RedHatPlugin):
"su vdsm -s /bin/sh -c 'ls -lR /rhev/data-center'"
])
self.add_cmd_output([
- "lvm vgs -v -o +tags --config \'%s\'" % LVM_CONFIG,
- "lvm lvs -v -o +tags --config \'%s\'" % LVM_CONFIG,
- "lvm pvs -v -o +all --config \'%s\'" % LVM_CONFIG
+ f"lvm vgs -v -o +tags --config \'{LVM_CONFIG}\'",
+ f"lvm lvs -v -o +tags --config \'{LVM_CONFIG}\'",
+ f"lvm pvs -v -o +all --config \'{LVM_CONFIG}\'"
])
self.add_cmd_output([
@@ -133,7 +133,7 @@ class Vdsm(Plugin, RedHatPlugin):
)
except ValueError as err:
self._log_error(
- 'vdsm-client Host getConnectedStoragePools: %s' % (err)
+ f'vdsm-client Host getConnectedStoragePools: {err}'
)
try:
@@ -146,7 +146,7 @@ class Vdsm(Plugin, RedHatPlugin):
])
except ValueError as err:
self._log_error(
- 'vdsm-client Host getStorageDomains: %s' % (err)
+ f'vdsm-client Host getStorageDomains: {err}'
)
def _add_vdsm_forbidden_paths(self):
diff --git a/sos/report/plugins/vectordev.py b/sos/report/plugins/vectordev.py
index 60338ac9..7ff5cc6b 100644
--- a/sos/report/plugins/vectordev.py
+++ b/sos/report/plugins/vectordev.py
@@ -32,7 +32,7 @@ class VectorDev(Plugin, IndependentPlugin):
]
# Redact yaml and ini style "key (:|=) value".
- keys_regex = r"(^\s*(%s)\s*(:|=)\s*)(.*)" % "|".join(protect_keys)
+ keys_regex = fr"(^\s*({'|'.join(protect_keys)})\s*(:|=)\s*)(.*)"
sub_regex = r"\1*********"
self.do_path_regex_sub(vector_config_path, keys_regex, sub_regex)
# Redact certificates
diff --git a/sos/report/plugins/vhostmd.py b/sos/report/plugins/vhostmd.py
index 4bbcd649..2569894e 100644
--- a/sos/report/plugins/vhostmd.py
+++ b/sos/report/plugins/vhostmd.py
@@ -37,11 +37,10 @@ class Vhostmd(Plugin, RedHatPlugin):
for disk in self.listdir(sysblock):
if "256K" in disk:
dev = disk.split()[0]
- ret = self.exec_cmd("dd if=/dev/%s bs=25 count=1"
- % dev)
+ ret = self.exec_cmd(f"dd if=/dev/{dev} bs=25 count=1")
if 'metric' in ret['output']:
self.add_cmd_output(
- "dd if=/dev/%s bs=256k count=1" % dev,
+ f"dd if=/dev/{dev} bs=256k count=1",
suggest_filename="virt_metrics"
)
diff --git a/sos/report/plugins/virsh.py b/sos/report/plugins/virsh.py
index 187ff5b5..f1d9b9d8 100644
--- a/sos/report/plugins/virsh.py
+++ b/sos/report/plugins/virsh.py
@@ -43,14 +43,14 @@ class LibvirtClient(Plugin, IndependentPlugin):
]
for subcmd in subcmds:
- self.add_cmd_output('%s %s' % (cmd, subcmd), foreground=True)
+ self.add_cmd_output(f'{cmd} {subcmd}', foreground=True)
- self.add_cmd_output("%s list --all" % cmd,
+ self.add_cmd_output(f"{cmd} list --all",
tags="virsh_list_all", foreground=True)
# get network, pool and nwfilter elements
for k in ['net', 'nwfilter', 'pool']:
- k_list = self.collect_cmd_output('%s %s-list %s' % (cmd, k, '--all'
+ k_list = self.collect_cmd_output(f'{cmd} {k}-list %s' % ('--all'
if k in ['net', 'pool'] else ''),
foreground=True)
if k_list['status'] == 0:
@@ -63,18 +63,18 @@ class LibvirtClient(Plugin, IndependentPlugin):
continue
for j in filter(lambda x: x, k_lines[2:]):
name = j.split()[pos]
- self.add_cmd_output('%s %s-dumpxml %s' % (cmd, k, name),
+ self.add_cmd_output(f'{cmd} {k}-dumpxml {name}',
foreground=True)
# cycle through the VMs/domains list, ignore 2 header lines and latest
# empty line, and dumpxml domain name in 2nd column
- domains_output = self.exec_cmd('%s list --all' % cmd, foreground=True)
+ domains_output = self.exec_cmd(f'{cmd} list --all', foreground=True)
if domains_output['status'] == 0:
domains_lines = domains_output['output'].splitlines()[2:]
for domain in filter(lambda x: x, domains_lines):
domain = domain.split()[1]
for opt in ['dumpxml', 'dominfo', 'domblklist']:
- self.add_cmd_output('%s %s %s' % (cmd, opt, domain),
+ self.add_cmd_output(f'{cmd} {opt} {domain}',
foreground=True)
nodedev_output = self.exec_cmd(f"{cmd} nodedev-list", foreground=True)
diff --git a/sos/report/plugins/vmware.py b/sos/report/plugins/vmware.py
index 2abecca1..a89f3f7a 100644
--- a/sos/report/plugins/vmware.py
+++ b/sos/report/plugins/vmware.py
@@ -48,7 +48,7 @@ class VMWare(Plugin, RedHatPlugin):
stats = self.exec_cmd("vmware-toolbox-cmd stat raw")
if stats['status'] == 0:
for _stat in stats['output'].splitlines():
- self.add_cmd_output("vmware-toolbox-cmd stat raw text %s"
- % _stat)
+ self.add_cmd_output("vmware-toolbox-cmd stat raw text"
+ f" {_stat}")
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/watchdog.py b/sos/report/plugins/watchdog.py
index b64a98ef..5094d16d 100644
--- a/sos/report/plugins/watchdog.py
+++ b/sos/report/plugins/watchdog.py
@@ -75,7 +75,7 @@ class Watchdog(Plugin, RedHatPlugin):
if res:
log_dir = res
except IOError as ex:
- self._log_warn("Could not read %s: %s" % (conf_file, ex))
+ self._log_warn(f"Could not read {conf_file}: {ex}")
if self.get_option('all_logs'):
log_files = glob(self.path_join(log_dir, '*'))
@@ -87,6 +87,6 @@ class Watchdog(Plugin, RedHatPlugin):
# Get output of "wdctl <device>" for each /dev/watchdog*
for dev in glob(self.path_join('/dev/watchdog*')):
- self.add_cmd_output("wdctl %s" % dev)
+ self.add_cmd_output(f"wdctl {dev}")
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/xfs.py b/sos/report/plugins/xfs.py
index 25b3dfd1..eb4bc6fa 100644
--- a/sos/report/plugins/xfs.py
+++ b/sos/report/plugins/xfs.py
@@ -30,9 +30,9 @@ class Xfs(Plugin, IndependentPlugin):
for dev in zip(self.do_regex_find_all(ext_fs_regex, mounts)):
for ext in dev:
parts = ext.split(' ')
- self.add_cmd_output("xfs_info %s" % (parts[1]),
+ self.add_cmd_output(f"xfs_info {parts[1]}",
tags="xfs_info")
- self.add_cmd_output("xfs_admin -l -u %s" % (parts[0]))
+ self.add_cmd_output(f"xfs_admin -l -u {parts[0]}")
self.add_copy_spec([
'/proc/fs/xfs',
diff --git a/sos/report/plugins/zfs.py b/sos/report/plugins/zfs.py
index 5bbf90d9..6df4b55a 100644
--- a/sos/report/plugins/zfs.py
+++ b/sos/report/plugins/zfs.py
@@ -54,6 +54,6 @@ class Zfs(Plugin, IndependentPlugin):
if zpools['status'] == 0:
zpools_list = zpools['output'].splitlines()
for zpool in zpools_list:
- self.add_cmd_output("zpool get all %s" % zpool)
+ self.add_cmd_output(f"zpool get all {zpool}")
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/zvm.py b/sos/report/plugins/zvm.py
index 06c84ffd..c202bcbd 100644
--- a/sos/report/plugins/zvm.py
+++ b/sos/report/plugins/zvm.py
@@ -91,14 +91,14 @@ class ZVM(Plugin, IndependentPlugin):
"ind user"
]
- vm_id_out = self.collect_cmd_output("%s q userid" % vm_cmd)
+ vm_id_out = self.collect_cmd_output(f"{vm_cmd} q userid")
if vm_id_out['status'] == 0:
vm_id = vm_id_out['output'].split()[0]
vm_cmds.extend([
- "q reorder %s" % vm_id,
- "q quickdsp %s" % vm_id
+ f"q reorder {vm_id}",
+ f"q quickdsp {vm_id}",
])
- self.add_cmd_output(["%s %s" % (vm_cmd, vcmd) for vcmd in vm_cmds])
+ self.add_cmd_output([f"{vm_cmd} {vcmd}" for vcmd in vm_cmds])
# vim: set et ts=4 sw=4 :