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
Avoid crash with None tasks #1048
Conversation
f00bf4f
to
dd49467
Compare
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.
empty name with no action would be a good test case, isn't it?
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.
The if foo in (bar or []):
is weird syntax to my eyes. Took me a minute to get what it's doing, I've just never seen it used like this in Python before. Once I got my eyes wrapped around it, this looks good.
Yes is weird, probably I guess you need a better python knowledge to know that "False or []" returns |
As ansible allows tasks to be None, we should also avoid crashing when encountering them. Includes regression prevention by assuring we can parse files with empty tasks. Fixes: #468
dd49467
to
aee0027
Compare
Yes, I've seen it used in assignment and short-hand execution but hadn't seen it used in a conditional before. I agree that this form is the more commonly encountered conditional guard from my experience. |
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.
lgtm
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.
lgtm
As ansible allows tasks to be None, we should also avoid crashing when
encountering them.
Includes regression prevention by assuring we can parse files
with empty tasks.
Fixes: #468