diff --git a/pylintrc b/pylintrc index 110f0ecc21..b0852d8b28 100644 --- a/pylintrc +++ b/pylintrc @@ -39,12 +39,10 @@ disable= ###################### VV things we should fix VV W0719, # broad-exception-raised W1203, # logging-fstring-interpolation - W0107, # unnecessary-pass W0718, # broad-exception-caught W0102, # dangerous-default-value C0201, # consider-iterating-dictionary W1201, # logging-not-lazy W0707, # raise-missing-from W0212, # protected-access - W0223, # abstract-method W1509, # subprocess-popen-preexec-fn diff --git a/sos/archive.py b/sos/archive.py index cab724f34f..3374899220 100644 --- a/sos/archive.py +++ b/sos/archive.py @@ -116,18 +116,18 @@ def get_archive_path(self): directory based cache prior to packaging should return the path to the temporary directory where the report content is located""" - pass + raise NotImplementedError def cleanup(self): """Clean up any temporary resources used by an Archive class.""" - pass + raise NotImplementedError def finalize(self, method): """Finalize an archive object via method. This may involve creating An archive that is subsequently compressed or simply closing an archive that supports in-line handling. If method is automatic then the following methods are tried in order: xz, gzip""" - pass + raise NotImplementedError class FileCacheArchive(Archive): diff --git a/sos/collector/clusters/__init__.py b/sos/collector/clusters/__init__.py index 4bddd5fa63..1e10379284 100644 --- a/sos/collector/clusters/__init__.py +++ b/sos/collector/clusters/__init__.py @@ -260,7 +260,6 @@ def set_node_options(self, node): :param node: The non-primary node :type node: ``SoSNode`` """ - pass def set_transport_type(self): """The default connection type used by sos collect is to leverage the @@ -280,7 +279,6 @@ def set_primary_options(self, node): :param node: The primary node :type node: ``SoSNode`` """ - pass def check_node_is_primary(self, node): """In the event there are multiple primaries, or if the collect command @@ -324,7 +322,6 @@ def setup(self): extra commands to be run even if a node list is given by the user, and thus get_nodes() would not be called """ - pass def check_enabled(self): """ @@ -352,7 +349,6 @@ def cleanup(self): This helps ensure that sos does make lasting changes to the environment in which we are running """ - pass def get_nodes(self): """ diff --git a/sos/component.py b/sos/component.py index 6f42046022..e95ae4caa8 100644 --- a/sos/component.py +++ b/sos/component.py @@ -199,7 +199,7 @@ def add_parser_options(cls, parser): """This should be overridden by each subcommand to add its own unique options to the parser """ - pass + raise NotImplementedError def apply_options_from_cmdline(self, opts): """(Re-)apply options specified via the cmdline to an options instance diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py index 4731cc93ee..dd05a5806f 100644 --- a/sos/policies/__init__.py +++ b/sos/policies/__init__.py @@ -197,7 +197,6 @@ def dist_version(self): """ Return the OS version """ - pass def get_preferred_archive(self): """ @@ -308,13 +307,11 @@ def pre_work(self): """ This function is called prior to collection. """ - pass def post_work(self): """ This function is called after the sos report has been generated. """ - pass def pkg_by_name(self, pkg): """Wrapper to retrieve a package from the Policy's package manager diff --git a/sos/policies/distros/__init__.py b/sos/policies/distros/__init__.py index 162b161fb3..98e6b527a3 100644 --- a/sos/policies/distros/__init__.py +++ b/sos/policies/distros/__init__.py @@ -139,6 +139,14 @@ def set_forbidden_paths(cls): '/etc/shadow' ] + @classmethod + def check(cls, remote=''): + """ + This function is responsible for determining if the underlying system + is supported by this policy. + """ + raise NotImplementedError + def kernel_version(self): return self.release @@ -1063,5 +1071,12 @@ class GenericLinuxPolicy(LinuxPolicy): 'users are encouraged to request a new distribution-specifc' ' policy at the GitHub project above.\n') + @classmethod + def check(cls, remote=''): + """ + This function is responsible for determining if the underlying system + is supported by this policy. + """ + raise NotImplementedError # vim: set et ts=4 sw=4 : diff --git a/sos/policies/init_systems/__init__.py b/sos/policies/init_systems/__init__.py index d313b23cbc..f3c4d5f67c 100644 --- a/sos/policies/init_systems/__init__.py +++ b/sos/policies/init_systems/__init__.py @@ -112,7 +112,7 @@ def load_all_services(self): This must be overridden by anything that subclasses `InitSystem` in order for service methods to function properly """ - pass + raise NotImplementedError def _query_service(self, name): """Query an individual service""" diff --git a/sos/policies/package_managers/__init__.py b/sos/policies/package_managers/__init__.py index 9be2efab72..b6ff28f63e 100644 --- a/sos/policies/package_managers/__init__.py +++ b/sos/policies/package_managers/__init__.py @@ -335,6 +335,23 @@ def __init__(self, primary, fallbacks, chroot=None, remote_exec=None): self._managers = [self.primary] self._managers.extend(self.fallbacks) + def _parse_pkg_list(self, pkg_list): + """ + Using the output of `query_command`, build the _packages dict. + + This should be overridden by distinct package managers and be a + generator for _generate_pkg_list which will insert the packages into + the _packages dict. + + This method should yield a tuple of name, version, release for each + package parsed. If the package manager or distribution does not use a + release field, set it to None. + + :param pkg_list: The output of the result of `query_command` + :type pkg_list: ``str`` + """ + raise NotImplementedError + def all_files(self): if not self.files: for pm in self._managers: diff --git a/sos/report/plugins/__init__.py b/sos/report/plugins/__init__.py index fc23a900ab..7bd26b1abb 100644 --- a/sos/report/plugins/__init__.py +++ b/sos/report/plugins/__init__.py @@ -3216,7 +3216,6 @@ def collect(self): are more likely to be interrupted by timeouts than file or command output collections. """ - pass @contextlib.contextmanager def collection_file(self, fname, subdir=None, tags=[]): @@ -3470,7 +3469,6 @@ def path_join(self, path, *p): def postproc(self): """Perform any postprocessing. To be replaced by a plugin if required. """ - pass def check_process_by_name(self, process): """Checks if a named process is found in /proc/[0-9]*/cmdline. diff --git a/tests/sos_tests.py b/tests/sos_tests.py index ded1c1a23b..00576890b9 100644 --- a/tests/sos_tests.py +++ b/tests/sos_tests.py @@ -319,20 +319,17 @@ def post_test_tear_down(self): """Called at the end of a test run to ensure that any needed per-test cleanup can be done. """ - pass def setup_mocking(self): """Since we need to use setUp() in our overrides of avocado.Test, provide an alternate method for test cases that subclass BaseSoSTest to use. """ - pass def pre_sos_setup(self): """Do any needed non-mocking setup prior to the sos execution that is called in setUp() """ - pass def assertFileExists(self, fname): """Asserts that fname exists on the filesystem""" diff --git a/tests/unittests/policy_tests.py b/tests/unittests/policy_tests.py index a64275b8cb..bdca6fcf35 100644 --- a/tests/unittests/policy_tests.py +++ b/tests/unittests/policy_tests.py @@ -21,10 +21,18 @@ class FauxPolicy(Policy): distro = "Faux" + @classmethod + def check(cls, remote=''): + return False + class FauxLinuxPolicy(LinuxPolicy): distro = "FauxLinux" + @classmethod + def check(cls, remote=''): + return False + @classmethod def set_forbidden_paths(cls): return ['/etc/secret']