Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analyzer: Only import sssd.source_* when needed #6125

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/tools/analyzer/modules/request.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -77,8 +75,10 @@ def load(self, args):
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

Expand Down Expand Up @@ -143,7 +143,7 @@ def consume_line(self, line, source, consume):
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)
Expand Down Expand Up @@ -225,7 +225,7 @@ def list_requests(self, args):
source.set_component(component, False)
self.done = ""
for line in self.matched_line(source, patterns):
if isinstance(source, Journald):
if type(source).__name__ == 'Journald':
print(line)
else:
self.print_formatted(line, args.verbose)
Expand Down