-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
Ensure Clear Linux parsing is actually parsing a Clear Linux host and all others fall back to NA #53298
Merged
samdoran
merged 3 commits into
ansible:devel
from
samdoran:clear-linux-coreos-distribution
Mar 8, 2019
Merged
Ensure Clear Linux parsing is actually parsing a Clear Linux host and all others fall back to NA #53298
samdoran
merged 3 commits into
ansible:devel
from
samdoran:clear-linux-coreos-distribution
Mar 8, 2019
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fixes a bug where parse_distribution_file_ClearLinux() was called on CoreOS (and probably many other distros) and it returned True since it successfully parses the distribution file. Since this file exists on many Linux distributions and they are very similar format, add an additional check to make sure it is Clear Linux. Change the order in which distribution files are processed no NA is last. This prevents a match on CoreOS hosts since they also have /etc/os-release and the last item in OSDIST_LIST wins.
ansibot
added
affects_2.8
This issue/PR affects Ansible v2.8
bug
This issue/PR relates to a bug.
core_review
In order to be merged, this PR must follow the core review workflow.
needs_triage
Needs a first human triage before being processed.
support:core
This issue/PR relates to code supported by the Ansible Engineering Team.
needs_revision
This PR fails CI tests or a maintainer has requested a review/revision of the PR.
and removed
core_review
In order to be merged, this PR must follow the core review workflow.
labels
Mar 4, 2019
@samdoran Could you please add unit test for this change ? Thanks. |
Only add tests for Clear Linux parsing since that was the cause of this issue.
ansibot
added
core_review
In order to be merged, this PR must follow the core review workflow.
and removed
needs_revision
This PR fails CI tests or a maintainer has requested a review/revision of the PR.
labels
Mar 6, 2019
maxamillion
approved these changes
Mar 7, 2019
shipit |
ansibot
added
shipit
This PR is ready to be merged by Core
and removed
core_review
In order to be merged, this PR must follow the core review workflow.
labels
Mar 7, 2019
shipit |
Akasurde
approved these changes
Mar 8, 2019
samdoran
added a commit
to samdoran/ansible
that referenced
this pull request
Mar 8, 2019
…inux host and all others fall back to NA (ansible#53298) Fixes a bug where parse_distribution_file_ClearLinux() was called on CoreOS (and probably many other distros) and it returned True since it successfully parses the distribution file. Since this file exists on many Linux distributions and they are a very similar format, add an additional check to make sure it is Clear Linux. Change the order in which distribution files are processed so NA is last. This prevents a match on CoreOS hosts since they also have /etc/os-release and the called matching function for NA is very general and will match CoreOS. * Add changelog * Add unit tests Only add tests for Clear Linux parsing since that was the cause of this issue. (cherry picked from commit 1d91e03) Co-authored-by: Sam Doran <sdoran@redhat.com>
abadger
pushed a commit
that referenced
this pull request
Mar 11, 2019
…inux host and all others fall back to NA (#53298) (#53541) * [stable-2.7] Ensure Clear Linux parsing is actually parsing a Clear Linux host and all others fall back to NA (#53298) Fixes a bug where parse_distribution_file_ClearLinux() was called on CoreOS (and probably many other distros) and it returned True since it successfully parses the distribution file. Since this file exists on many Linux distributions and they are a very similar format, add an additional check to make sure it is Clear Linux. Change the order in which distribution files are processed so NA is last. This prevents a match on CoreOS hosts since they also have /etc/os-release and the called matching function for NA is very general and will match CoreOS. * Add changelog * Add unit tests Only add tests for Clear Linux parsing since that was the cause of this issue. (cherry picked from commit 1d91e03) Co-authored-by: Sam Doran <sdoran@redhat.com> * Use different import for 2.7
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
affects_2.8
This issue/PR affects Ansible v2.8
bug
This issue/PR relates to a bug.
P3
Priority 3 - Approved, No Time Limitation
shipit
This PR is ready to be merged by Core
support:core
This issue/PR relates to code supported by the Ansible Engineering Team.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SUMMARY
Fixes a bug where
parse_distribution_file_ClearLinux()
was called on CoreOS (and probably many other distros that had/etc/os-release
) and it returnedTrue
since it successfully parsed the distribution file and there was no check of theNAME
field to ensure it was actually a Clear Linux host.Change the order in which distribution files are processed so NA is last. This prevents a match on CoreOS hosts since they also have /etc/os-release and the last item in
OSDIST_LIST
wins.Fixes #50009
Depends on #52199
Before this change:
After this change:
The change is subtle:
ansible_distribution_file_variety
is now correct, which means we used the correct distribution file parsing method.ISSUE TYPE
COMPONENT NAME
lib/ansible/module_utils/facts/system/distribution.py
ADDITIONAL INFORMATION
Here is
/etc/os-release
from Linux Mint, Clear Linux, and CoreOS: