aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2018-05-15 15:29:58 +0100
committerBryn M. Reeves <bmr@redhat.com>2018-05-15 15:29:58 +0100
commit7eb9bcb1e5d0452d714d181bd9c88c01344b6fbe (patch)
tree35f29307668830b956ddfcf7cb1f8d37636c3731
parent3d5143678428119953337a74570d181633f0fcf5 (diff)
downloadsos-7eb9bcb1e5d0452d714d181bd9c88c01344b6fbe.tar.gz
[libvirt] simplify libvirt postprocessing
Instead of the ad-hoc globbing and do_file_sub(), drive a loop over do_path_regex_sub() from a list of candidate config file locations. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/libvirt.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/sos/plugins/libvirt.py b/sos/plugins/libvirt.py
index 18e06942..38477ee7 100644
--- a/sos/plugins/libvirt.py
+++ b/sos/plugins/libvirt.py
@@ -71,12 +71,13 @@ class Libvirt(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
self.add_copy_spec("/proc/%s/%s" % (pid, pf))
def postproc(self):
- for loc in ["/etc/", "/var/run/"]:
- for xmlfile in glob.glob(loc + "libvirt/qemu/*.xml"):
- self.do_file_sub(
- xmlfile,
- r"(\s*passwd=\s*')([^']*)('.*)",
- r"\1******\3"
- )
+ match_exp = r"(\s*passwd=\s*')([^']*)('.*)"
+ libvirt_path_exps = [
+ "/etc/libvirt/qemu/.*\.xml",
+ "/var/run/libvirt/qemu/.*\.xml",
+ "/etc/libvirt/.*\.conf"
+ ]
+ for path_exp in libvirt_path_exps:
+ self.do_path_regex_sub(path_exp, match_exp, r"\1******\3")
# vim: set et ts=4 sw=4 :