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

fix: NoFilterException is redundant, remove it #4185

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
5 changes: 0 additions & 5 deletions insights/core/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,6 @@ class ContentException(SkipComponent):
pass


class NoFilterException(ContentException):
""" Raised whenever no filters added to a `filterable` :class:`datasource`."""
pass


class InvalidContentType(InvalidArchive):
def __init__(self, content_type):
self.msg = 'Invalid content type: "%s"' % content_type
Expand Down
11 changes: 6 additions & 5 deletions insights/core/spec_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from insights.core.exceptions import (
BlacklistedSpec,
ContentException,
NoFilterException,
SkipComponent)
from insights.core.plugins import component, datasource, is_datasource
from insights.core.serde import deserializer, serializer
Expand Down Expand Up @@ -191,7 +190,7 @@ def validate(self):
if (self.ds and filters.ENABLED and
any(s.filterable for s in dr.get_registry_points(self.ds)) and
not filters.get_filters(self.ds)):
raise NoFilterException("Skipping %s due to no filters." % dr.get_name(self.ds))
raise ContentException("Skipping %s due to no filters." % dr.get_name(self.ds))
# 2.2 Customer Prohibits Collection
if not blacklist.allow_file("/" + self.relative_path):
log.warning("WARNING: Skipping file %s", "/" + self.relative_path)
Expand Down Expand Up @@ -367,7 +366,7 @@ def validate(self):
if (self.ds and filters.ENABLED and
any(s.filterable for s in dr.get_registry_points(self.ds)) and
not filters.get_filters(self.ds)):
raise NoFilterException("Skipping %s due to no filters." % dr.get_name(self.ds))
raise ContentException("Skipping %s due to no filters." % dr.get_name(self.ds))
# 2.2 Customer Prohibits Collection
if not blacklist.allow_command(self.cmd):
log.warning("WARNING: Skipping command %s", self.cmd)
Expand Down Expand Up @@ -702,6 +701,8 @@ def __call__(self, broker):
results.append(self.kind(
path[len(root):], root=root, save_as=self.save_as,
ds=self, ctx=ctx, cleaner=cleaner))
except ContentException as ce:
log.debug(ce)
except Exception:
log.debug(traceback.format_exc())
if results:
Expand Down Expand Up @@ -770,8 +771,8 @@ def __call__(self, broker):
return self.kind(
ctx.locate_path(p), root=root, save_as=self.save_as,
ds=self, ctx=ctx, cleaner=cleaner)
except NoFilterException as nfe:
raise nfe
except ContentException as ce:
log.debug(ce)
except Exception:
pass
raise ContentException("None of [%s] found." % ', '.join(self.paths))
Expand Down
Loading