diff options
author | Jake Hunsaker <jhunsake@redhat.com> | 2022-06-22 12:31:03 -0400 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2022-06-27 11:28:42 -0400 |
commit | aeea49de699cad2ee89f6e3908cb6b96bccbd49b (patch) | |
tree | 4d2b496f0f159823eec0698d1956c26e20ec8271 | |
parent | 92f921b901a31f43204a9b08538bc9afdfa56b93 (diff) | |
download | sos-aeea49de699cad2ee89f6e3908cb6b96bccbd49b.tar.gz |
[policies] Remove deadcode around runlevels
Removes the `runlevel_by_service()` methods from the redhat and suse
policies, as these methods are both outdated (by trying to leverage
`chkconfig`) and entirely unsued.
Further, removes the `LinuxPolicy.default_runlevel()` method as it is
similarly unused in sos.
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r-- | sos/policies/distros/__init__.py | 9 | ||||
-rw-r--r-- | sos/policies/distros/redhat.py | 22 | ||||
-rw-r--r-- | sos/policies/distros/suse.py | 22 |
3 files changed, 0 insertions, 53 deletions
diff --git a/sos/policies/distros/__init__.py b/sos/policies/distros/__init__.py index 8fbc0de4..a1051fa1 100644 --- a/sos/policies/distros/__init__.py +++ b/sos/policies/distros/__init__.py @@ -116,15 +116,6 @@ class LinuxPolicy(Policy): '/etc/shadow' ] - def default_runlevel(self): - try: - with open("/etc/inittab") as fp: - pattern = r"id:(\d{1}):initdefault:" - text = fp.read() - return int(re.findall(pattern, text)[0]) - except (IndexError, IOError): - return 3 - def kernel_version(self): return self.release diff --git a/sos/policies/distros/redhat.py b/sos/policies/distros/redhat.py index be4a6030..a6ac5efc 100644 --- a/sos/policies/distros/redhat.py +++ b/sos/policies/distros/redhat.py @@ -160,28 +160,6 @@ class RedHatPolicy(LinuxPolicy): else: return files - def runlevel_by_service(self, name): - from subprocess import Popen, PIPE - ret = [] - p = Popen("LC_ALL=C /sbin/chkconfig --list %s" % name, - shell=True, - stdout=PIPE, - stderr=PIPE, - bufsize=-1, - close_fds=True) - out, err = p.communicate() - if err: - return ret - for tabs in out.split()[1:]: - try: - (runlevel, onoff) = tabs.split(":", 1) - except IndexError: - pass - else: - if onoff == "on": - ret.append(int(runlevel)) - return ret - def get_tmp_dir(self, opt_tmp_dir): if not opt_tmp_dir: return self._tmp_dir diff --git a/sos/policies/distros/suse.py b/sos/policies/distros/suse.py index b9d4a3b1..d1b5ea77 100644 --- a/sos/policies/distros/suse.py +++ b/sos/policies/distros/suse.py @@ -51,28 +51,6 @@ class SuSEPolicy(LinuxPolicy): OpenSuSE, SLES or other Suse distribution and False otherwise.""" return False - def runlevel_by_service(self, name): - from subprocess import Popen, PIPE - ret = [] - p = Popen("LC_ALL=C /sbin/chkconfig --list %s" % name, - shell=True, - stdout=PIPE, - stderr=PIPE, - bufsize=-1, - close_fds=True) - out, err = p.communicate() - if err: - return ret - for tabs in out.split()[1:]: - try: - (runlevel, onoff) = tabs.split(":", 1) - except IndexError: - pass - else: - if onoff == "on": - ret.append(int(runlevel)) - return ret - def get_tmp_dir(self, opt_tmp_dir): if not opt_tmp_dir: return self._tmp_dir |