-
Notifications
You must be signed in to change notification settings - Fork 152
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
Must be null related issues #352
Must be null related issues #352
Conversation
Pull Request Test Coverage Report for Build 1196
💛 - Coveralls |
regex = r'{}'.format(u'(\x00|^$)$') | ||
is_null = lambda x: x in ([], {}, None, Null) or (isinstance(x, str) and match.regex_match(regex, x)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not checking for the string 'null' as it's converted to None automatically
is_null = lambda x: x in ([], {}, None, Null) or (isinstance(x, str) and match.regex_match(regex, x)) | ||
|
||
for resource in _step_obj.context.stash: | ||
values = resource.get('values', {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Smells legacy code. Is it even possible to not have values in a resource anymore?
Error(_step_obj, '{} property in {} is considered to be {}. It is set to {}.'.format(_step_obj.context.property_name, | ||
resource.get('address', _step_obj.context.name), | ||
'Null' if values_is_null else 'not Null', | ||
values)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the error message:
can also put them both at the same time but feels a bit cluttery
e.g. _step_obj.context.name, resource.get('address', 'address could not be resolved')
Then it must contain something
Then it must be null
This used to be a special case of Then its value condition match the "search regex" regex. This was problematic and not enough as documented by the listed issues.
Definition of what is considered to be null or not in this step is ambiguous and not documented well enough. (Once this PR is approved, documentation should be updated with the most recent state of the branch as well)
Current decisions is as follows:
tags
property. This should be considered as null (Used to be no)null
s in the planfile/main.tf are converted toNone
s in python. Having a'null'
is more likely to indicate the value is not null but happened to be named'null'
than otherwise.null
valueBig Decision
condition must -> Fail if at least one element is not Null (i.e. Ok if all elements are null)
Addresses #338, #343