From cab407857781c4f6c93cf919d270f592d43914c6 Mon Sep 17 00:00:00 2001 From: Jake Hunsaker Date: Wed, 9 Oct 2019 15:17:34 -0400 Subject: [InitSystem] Move load_all_services() out from base __init__() Moves the call to load_all_services() out from the base __init__() of InitSystem() and into SystemdInit(), as highlighted by LGTM.com analysis. Signed-off-by: Jake Hunsaker --- sos/policies/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py index bd9ea4b1..a19daf22 100644 --- a/sos/policies/__init__.py +++ b/sos/policies/__init__.py @@ -65,8 +65,6 @@ class InitSystem(object): self.list_cmd = "%s %s" % (self.init_cmd, list_cmd) or None self.query_cmd = "%s %s" % (self.init_cmd, query_cmd) or None - self.load_all_services() - def is_enabled(self, name): """Check if given service name is enabled """ if self.services and name in self.services: @@ -150,6 +148,7 @@ class SystemdInit(InitSystem): list_cmd='list-unit-files --type=service', query_cmd='status' ) + self.load_all_services() def parse_query(self, output): for line in output.splitlines(): -- cgit