forked from ansible-collections/community.docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make current_container_facts work with newer Docker versions and late…
…st ansible-test container changes (ansible-collections#510) * Add more debug output. * Add basic integration test. * Split into lines. * Fix docker detection, add podman detection. ci_complete * Improve regular expression. * Document that this module is trying its best, but might not be perfect. * Update comment.
- Loading branch information
1 parent
ee9ddb9
commit c2d84ef
Showing
4 changed files
with
84 additions
and
7 deletions.
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,2 @@ | ||
minor_changes: | ||
- "current_container_facts - make work with current Docker version, also support Podman (https://github.com/ansible-collections/community.docker/pull/510)." |
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
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,6 @@ | ||
# Copyright (c) Ansible Project | ||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
azp/4 | ||
skip/rhel |
41 changes: 41 additions & 0 deletions
41
tests/integration/targets/current_container_facts/tasks/main.yml
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,41 @@ | ||
--- | ||
# Copyright (c) Ansible Project | ||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
#################################################################### | ||
# WARNING: These are designed specifically for Ansible tests # | ||
# and should not be used as examples of how to write Ansible roles # | ||
#################################################################### | ||
|
||
- name: Get facts | ||
current_container_facts: | ||
register: result | ||
|
||
# WARNING: This is not a proper test as it won't fail when the module does not work! | ||
# To make this a proper test, we need to know the environment in which this | ||
# test runs, which we do not know in general... | ||
|
||
- name: Print facts | ||
ansible.builtin.debug: | ||
var: result.ansible_facts | ||
|
||
- name: Read files | ||
ansible.builtin.slurp: | ||
src: '{{ item }}' | ||
loop: | ||
- /proc/self/cgroup | ||
- /proc/self/cpuset | ||
- /proc/self/mountinfo | ||
register: slurp | ||
ignore_errors: true | ||
|
||
- name: Print files | ||
ansible.builtin.debug: | ||
msg: |- | ||
{{ item.content | ansible.builtin.b64decode | split(' | ||
') }} | ||
loop: '{{ slurp.results }}' | ||
loop_control: | ||
label: '{{ item.source | default(item.item) }}' | ||
when: item is not failed |