aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches/sssd-optional-systemd.patch
blob: e6d74e79fa38e20b59f0af23d2aaef4987ba2318 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Allow running sss_analyze without Python modules for systemd.
Upstream PR: https://github.com/SSSD/sssd/pull/6125

diff --git a/src/tools/analyzer/modules/request.py b/src/tools/analyzer/modules/request.py
index b9fe3caf8..51ec3a151 100644
--- a/src/tools/analyzer/modules/request.py
+++ b/src/tools/analyzer/modules/request.py
@@ -1,8 +1,6 @@
 import re
 import logging
 
-from sssd.source_files import Files
-from sssd.source_journald import Journald
 from sssd.parser import SubparsersAction
 from sssd.parser import Option
 
@@ -76,8 +74,10 @@ class RequestAnalyzer:
             Instantiated source object
         """
         if args.source == "journald":
+            from sssd.source_journald import Journald
             source = Journald()
         else:
+            from sssd.source_files import Files
             source = Files(args.logdir)
         return source
 
@@ -142,7 +142,7 @@ class RequestAnalyzer:
             self.consumed_logs.append(line.rstrip(line[-1]))
         else:
             # files source includes newline
-            if isinstance(source, Files):
+            if type(source).__name__ == 'Files':
                 print(line, end='')
             else:
                 print(line)
@@ -240,7 +240,7 @@ class RequestAnalyzer:
             self.print_formatted_verbose(source, patterns)
         else:
             for line in self.matched_line(source, patterns):
-                if isinstance(source, Journald):
+                if type(source).__name__ == 'Journald':
                     print(line)
                 else:
                     self.print_formatted(line)