1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/tests/integration/targets/kernel_blacklist/tasks/main.yml
patchback[bot] bc2403042a
[PR #5098/aab22e7f backport][stable-5] Add remaining copyright statements, add licenses sanity test (#5099)
* Add remaining copyright statements, add licenses sanity test (#5098)

* Add sanity test (currently fails).

* doc_fragments can also be non-GPLv3+.

* Replace 'Author:' by 'Copyright:' in some specific cases.

* Avoid matching string for license checkers.

* Reformulate not to throw license detection off.

* Add PSF copyright notice for plugins/module_utils/_mount.py.

* Add generic copyright notices.

* Update changelog fragment.

(cherry picked from commit aab22e7f32)

* Update copyright statements. (#5106)

(cherry picked from commit c8925058aa)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-08-14 10:26:44 +02:00

111 lines
2.8 KiB
YAML

---
# 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
- name: set destination filename
set_fact:
bl_file: '{{ remote_tmp_dir }}/blacklist-ansible.conf'
- name: copy blacklist file
copy:
src: 'files/blacklist'
dest: '{{ bl_file }}'
- name: Original stat
stat:
path: '{{ bl_file }}'
register: orig_stat
- name: remove non-existing item from list
community.general.kernel_blacklist:
blacklist_file: '{{ bl_file }}'
state: absent
name: zzzz
register: bl_test_1
- name: add existing item from list
community.general.kernel_blacklist:
blacklist_file: '{{ bl_file }}'
state: present
name: bbbb
register: bl_test_1a
- name: stat_test_1
stat:
path: '{{ bl_file }}'
register: stat_test_1
- name: assert file is unchanged
assert:
that:
- bl_test_1 is not changed
- bl_test_1a is not changed
- orig_stat.stat.size == stat_test_1.stat.size
- orig_stat.stat.checksum == stat_test_1.stat.checksum
- orig_stat.stat.mtime == stat_test_1.stat.mtime
- stat_test_1.stat.checksum == expected_content | checksum
vars:
expected_content: |
# 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
blacklist aaaa
blacklist bbbb
blacklist cccc
- name: add new item to list
community.general.kernel_blacklist:
blacklist_file: '{{ bl_file }}'
state: present
name: dddd
register: bl_test_2
- name: slurp_test_2
slurp:
src: '{{ bl_file }}'
register: slurp_test_2
- name: assert element is added
assert:
that:
- bl_test_2 is changed
- slurp_test_2.content|b64decode == content
vars:
content: |
# 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
blacklist aaaa
blacklist bbbb
blacklist cccc
blacklist dddd
- name: remove item from list
community.general.kernel_blacklist:
blacklist_file: '{{ bl_file }}'
state: absent
name: bbbb
register: bl_test_3
- name: slurp_test_3
slurp:
src: '{{ bl_file }}'
register: slurp_test_3
- name: assert element is added
assert:
that:
- bl_test_3 is changed
- slurp_test_3.content|b64decode == content
vars:
content: |
# 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
blacklist aaaa
blacklist cccc
blacklist dddd