-
Notifications
You must be signed in to change notification settings - Fork 23.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[stable-2.18] facts: Skip path if the distribution path is directory (#…
…84036) Skip path if the distribution path is directory instead of file. Handle exception raised while handling distribution path. Fixes: #84006 Signed-off-by: Abhijeet Kasurde <[email protected]> (cherry picked from commit 34f8f55)
- Loading branch information
Showing
3 changed files
with
21 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
bugfixes: | ||
- facts - skip if distribution file path is directory, instead of raising error (https://github.com/ansible/ansible/issues/84006). |
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
17 changes: 17 additions & 0 deletions
17
test/units/module_utils/facts/system/distribution/test_distribution_files.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright: Contributors to the Ansible project | ||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
|
||
from __future__ import annotations | ||
|
||
import tempfile | ||
|
||
|
||
from ansible.module_utils.facts.system.distribution import DistributionFiles | ||
|
||
|
||
def test_distribution_files(mock_module): | ||
d = DistributionFiles(mock_module) | ||
temp_dir = tempfile.TemporaryDirectory() | ||
dist_file, dist_file_content = d._get_dist_file_content(temp_dir.name) | ||
assert not dist_file | ||
assert dist_file_content is None |