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
Account for empty strings when splitting the host pattern #62442
Account for empty strings when splitting the host pattern #62442
Conversation
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.
shipit
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.
behaviour pre 2.9 (i checked 2.8-2.4) was always '' == ','
, which this restores
- add more unit test cases - add specific integration test with more cases
The test
|
Testing shows no major downside to calling .strip() twice in a comprehnios vs. using a regular for loop and only calling .strip() once. Going with the comprehension for ease of maintenance and because comprehensions are optimized in CPython.
75cca92
to
37bbf1a
Compare
ansible#62442) Improve tests - add more unit test cases - add specific integration test with more cases Testing shows no major downside to calling .strip() twice in a comprehension vs. using a regular for loop and only calling .strip() once. Going with the comprehension for ease of maintenance and because comprehensions are optimized in CPython. (cherry picked from commit 987265a) Co-authored-by: Sam Doran <sdoran@redhat.com>
) Improve tests - add more unit test cases - add specific integration test with more cases Testing shows no major downside to calling .strip() twice in a comprehension vs. using a regular for loop and only calling .strip() once. Going with the comprehension for ease of maintenance and because comprehensions are optimized in CPython.
SUMMARY
Filter out empty strings when returning the list of hosts from
split_host_pattern()
.Fixes #61964
ISSUE TYPE
COMPONENT NAME
lib/ansible/inventory/manager.py