diff options
Diffstat (limited to 'lib/python2.7/site-packages/setools/typequery.py')
-rwxr-xr-x[-rw-r--r--] | lib/python2.7/site-packages/setools/typequery.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/python2.7/site-packages/setools/typequery.py b/lib/python2.7/site-packages/setools/typequery.py index 6634f76..8152984 100644..100755 --- a/lib/python2.7/site-packages/setools/typequery.py +++ b/lib/python2.7/site-packages/setools/typequery.py @@ -19,12 +19,13 @@ import logging import re -from . import compquery -from . import mixins from .descriptors import CriteriaSetDescriptor +from .mixins import MatchAlias, MatchName +from .query import PolicyQuery +from .util import match_regex_or_set -class TypeQuery(mixins.MatchAlias, compquery.ComponentQuery): +class TypeQuery(MatchAlias, MatchName, PolicyQuery): """ Query SELinux policy types. @@ -67,11 +68,15 @@ class TypeQuery(mixins.MatchAlias, compquery.ComponentQuery): else: self._permissive = bool(value) + def __init__(self, policy, **kwargs): + super(TypeQuery, self).__init__(policy, **kwargs) + self.log = logging.getLogger(__name__) + def results(self): """Generator which yields all matching types.""" - self.log.info("Generating results from {0.policy}".format(self)) - self.log.debug("Name: {0.name!r}, regex: {0.name_regex}".format(self)) - self.log.debug("Alias: {0.alias}, regex: {0.alias_regex}".format(self)) + self.log.info("Generating type results from {0.policy}".format(self)) + self._match_name_debug(self.log) + self._match_alias_debug(self.log) self.log.debug("Attrs: {0.attrs!r}, regex: {0.attrs_regex}, " "eq: {0.attrs_equal}".format(self)) self.log.debug("Permissive: {0.permissive}".format(self)) @@ -83,7 +88,7 @@ class TypeQuery(mixins.MatchAlias, compquery.ComponentQuery): if not self._match_alias(t): continue - if self.attrs and not self._match_regex_or_set( + if self.attrs and not match_regex_or_set( set(t.attributes()), self.attrs, self.attrs_equal, |