Sandro Bonazzola has uploaded a new change for review.

Change subject: sos: fixing backport issues
......................................................................

sos: fixing backport issues

fixing some bits left while backporting from sos 3.

Change-Id: I2ec54434502a6774da8f2bdf7e87d76df89a4fed
Bug-Url: https://bugzilla.redhat.com/1128839
Signed-off-by: Sandro Bonazzola <[email protected]>
(cherry picked from commit d0edf00b9e5bd40509e5a1a851fb556857a48d50)
---
M src/sos/plugins/ovirt.py
M src/sos/plugins/postgresql.py
2 files changed, 13 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-log-collector 
refs/changes/15/31415/1

diff --git a/src/sos/plugins/ovirt.py b/src/sos/plugins/ovirt.py
index 796026c..528b042 100644
--- a/src/sos/plugins/ovirt.py
+++ b/src/sos/plugins/ovirt.py
@@ -105,6 +105,14 @@
             "/var/tmp/ovirt-engine/config"
         ])
 
+    def do_path_regex_sub(self, pathexp, regexp, subst):
+        if not hasattr(pathexp, "match"):
+            pathexp = re.compile(pathexp)
+        match = pathexp.match
+        file_list = [f for f in self.copiedFiles if match(f['srcpath'])]
+        for fileobj in file_list:
+            self.doRegexSub(fileobj['srcpath'], regexp, subst)
+
     def postproc(self):
         """
         Obfuscate sensitive keys.
@@ -147,12 +155,12 @@
         ]
         for conf_file in passwd_files:
             conf_path = os.path.join("/etc/ovirt-engine", conf_file)
-            self.do_file_sub(
+            self.doRegexSub(
                 conf_path,
                 r"passwd=(.*)",
                 r"passwd=********"
             )
-            self.do_file_sub(
+            self.doRegexSub(
                 conf_path,
                 r"pg-pass=(.*)",
                 r"pg-pass=********"
@@ -160,7 +168,7 @@
 
         sensitive_keys = self.DEFAULT_SENSITIVE_KEYS
         # Handle --alloptions case which set this to True.
-        keys_opt = self.get_option('sensitive_keys')
+        keys_opt = self.getOption('sensitive_keys')
         if keys_opt and keys_opt is not True:
             sensitive_keys = keys_opt
         key_list = [x for x in sensitive_keys.split(':') if x]
diff --git a/src/sos/plugins/postgresql.py b/src/sos/plugins/postgresql.py
index 4eaf126..5681e40 100644
--- a/src/sos/plugins/postgresql.py
+++ b/src/sos/plugins/postgresql.py
@@ -112,10 +112,10 @@
             )
 
         # Copy PostgreSQL log files.
-        for filename in find("*.log", self.get_option("pghome")):
+        for filename in find("*.log", self.getOption("pghome")):
             self.addCopySpec(filename)
         # Copy PostgreSQL config files.
-        for filename in find("*.conf", self.get_option("pghome")):
+        for filename in find("*.conf", self.getOption("pghome")):
             self.addCopySpec(filename)
 
         self.addCopySpec(


-- 
To view, visit http://gerrit.ovirt.org/31415
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2ec54434502a6774da8f2bdf7e87d76df89a4fed
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-log-collector
Gerrit-Branch: ovirt-log-collector-3.5
Gerrit-Owner: Sandro Bonazzola <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to