Log outcome of check_conditions method.

Added logging to log
IntrospectionRule.check_conditions method
outcome for debugging purposes.

Change-Id: I8e7afee669b32de40b191990f693bf86e59a3e3c
Story: 2006995
Task: 40645
This commit is contained in:
Zygimantas Matonis 2020-08-11 14:32:21 +02:00
parent 73a97eb606
commit 17f58aad67

View File

@ -220,9 +220,18 @@ class IntrospectionRule(object):
:returns: True if conditions match, otherwise False
"""
if not self._scope:
LOG.debug('Rule "%s" is global and will be applied if conditions '
'are met.', self._description)
return True
return self._scope == \
node_info.node().properties.get('inspection_scope')
if self._scope == node_info.node().properties.get('inspection_scope'):
LOG.debug('Rule "%s" and node have a matching scope "%s and will '
'be applied if conditions are met.', self._description,
self._scope)
return True
else:
LOG.debug('Rule\'s "%s" scope "%s" does not match node\'s scope. '
'Rule will be ignored', self._description, self._scope)
return False
def _format_value(value, data):