Merge "is-empty conditions should accept missing values"

This commit is contained in:
Jenkins 2016-05-05 12:13:03 +00:00 committed by Gerrit Code Review
commit 86c4c15ed9
3 changed files with 5 additions and 0 deletions

View File

@ -69,6 +69,7 @@ class NeCondition(SimpleCondition):
class EmptyCondition(base.RuleConditionPlugin):
REQUIRED_PARAMS = set()
ALLOW_NONE = True
def check(self, node_info, field, params, **kwargs):
return field in ('', None, [], {})

View File

@ -320,6 +320,7 @@ class Test(Base):
{'field': 'inventory.interfaces[*].ipv4_address',
'op': 'contains', 'value': r'127\.0\.0\.1',
'invert': True, 'multiple': 'all'},
{'field': 'i.do.not.exist', 'op': 'is-empty'},
],
'actions': [
{'action': 'set-attribute', 'path': '/extra/foo',

View File

@ -0,0 +1,3 @@
---
fixes:
- Fixed the "is-empty" condition to return True on missing values.