mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-05-12 04:22:00 +00:00
Compare commits
8 Commits
2022c1bd86
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d88a3c833c | ||
|
|
c4b1c2b0fb | ||
|
|
67e398bc62 | ||
|
|
afa6471b73 | ||
|
|
871b4daeeb | ||
|
|
fe77b17251 | ||
|
|
28a09cd805 | ||
|
|
853a333142 |
@@ -122,22 +122,6 @@ stages:
|
|||||||
- name: Lint
|
- name: Lint
|
||||||
test: lint
|
test: lint
|
||||||
|
|
||||||
- stage: Sanity_2_17
|
|
||||||
displayName: Ansible 2.17 Sanity & Units & Lint
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
nameFormat: "{0}"
|
|
||||||
testFormat: 2.17/{0}
|
|
||||||
targets:
|
|
||||||
- name: Sanity
|
|
||||||
test: sanity
|
|
||||||
- name: Units
|
|
||||||
test: units
|
|
||||||
- name: Lint
|
|
||||||
test: lint
|
|
||||||
|
|
||||||
## Docker
|
## Docker
|
||||||
- stage: Docker_devel
|
- stage: Docker_devel
|
||||||
displayName: Docker devel
|
displayName: Docker devel
|
||||||
@@ -214,19 +198,6 @@ stages:
|
|||||||
- name: Ubuntu 24.04
|
- name: Ubuntu 24.04
|
||||||
test: ubuntu2404
|
test: ubuntu2404
|
||||||
|
|
||||||
- stage: Docker_2_17
|
|
||||||
displayName: Docker 2.17
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
testFormat: 2.17/linux/{0}/1
|
|
||||||
targets:
|
|
||||||
- name: Fedora 39
|
|
||||||
test: fedora39
|
|
||||||
- name: Ubuntu 22.04
|
|
||||||
test: ubuntu2204
|
|
||||||
|
|
||||||
## Remote
|
## Remote
|
||||||
- stage: Remote_devel
|
- stage: Remote_devel
|
||||||
displayName: Remote devel
|
displayName: Remote devel
|
||||||
@@ -311,28 +282,11 @@ stages:
|
|||||||
- name: FreeBSD 13.5
|
- name: FreeBSD 13.5
|
||||||
test: freebsd/13.5
|
test: freebsd/13.5
|
||||||
|
|
||||||
- stage: Remote_2_17
|
|
||||||
displayName: Remote 2.17
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
testFormat: 2.17/{0}/1
|
|
||||||
targets:
|
|
||||||
# 2.17 remote target doesn't have RHEL 9 image
|
|
||||||
- name: RHEL 10.0
|
|
||||||
test: rhel/10.0
|
|
||||||
- name: FreeBSD 13.5
|
|
||||||
test: freebsd/13.5
|
|
||||||
|
|
||||||
## Finally
|
## Finally
|
||||||
|
|
||||||
- stage: Summary
|
- stage: Summary
|
||||||
condition: succeededOrFailed()
|
condition: succeededOrFailed()
|
||||||
dependsOn:
|
dependsOn:
|
||||||
- Sanity_2_17
|
|
||||||
- Remote_2_17
|
|
||||||
- Docker_2_17
|
|
||||||
- Sanity_2_18
|
- Sanity_2_18
|
||||||
- Remote_2_18
|
- Remote_2_18
|
||||||
- Docker_2_18
|
- Docker_2_18
|
||||||
|
|||||||
2
changelogs/fragments/638_fix_recursive_acl.yml
Normal file
2
changelogs/fragments/638_fix_recursive_acl.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
bugfixes:
|
||||||
|
- acl - correctly assert needed changes when pointing to a directory and recursive is set to true.
|
||||||
3
changelogs/fragments/firewalld_info_warnings.yml
Normal file
3
changelogs/fragments/firewalld_info_warnings.yml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
minor_changes:
|
||||||
|
- firewalld_info - use module.warn instead of passing `warnings` to `exit_json` (https://github.com/ansible-collections/ansible.posix/issues/710).
|
||||||
@@ -244,16 +244,16 @@ def acl_changed(module, cmd, entry, use_nfsv4_acls=False):
|
|||||||
lines = run_acl(module, cmd)
|
lines = run_acl(module, cmd)
|
||||||
counter = 0
|
counter = 0
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if line.endswith('*,*') and not use_nfsv4_acls:
|
if not use_nfsv4_acls and not line.endswith('*,*'):
|
||||||
return False
|
return True
|
||||||
# if use_nfsv4_acls and entry is listed
|
# if use_nfsv4_acls and entry is listed
|
||||||
if use_nfsv4_acls and entry == line:
|
if use_nfsv4_acls and entry == line:
|
||||||
counter += 1
|
counter += 1
|
||||||
|
|
||||||
# The current 'nfs4_setfacl --test' lists a new entry,
|
# The current 'nfs4_setfacl --test' lists a new entry,
|
||||||
# which will be added at the top of list, followed by the existing entries.
|
# which will be added at the top of the list, followed by the existing entries.
|
||||||
# So if the entry has already been registered, the entry should be find twice.
|
# So if the entry has already been registered, the entry should be found twice.
|
||||||
if counter == 2:
|
if not use_nfsv4_acls or counter == 2:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
@@ -333,10 +333,6 @@ def main():
|
|||||||
if not HAS_FIREWALLD:
|
if not HAS_FIREWALLD:
|
||||||
module.fail_json(msg=missing_required_lib('python-firewall'))
|
module.fail_json(msg=missing_required_lib('python-firewall'))
|
||||||
|
|
||||||
# If you want to show warning messages in the task running process,
|
|
||||||
# you can append the message to the 'warn' list.
|
|
||||||
warn = list()
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
client = fw_client.FirewallClient()
|
client = fw_client.FirewallClient()
|
||||||
|
|
||||||
@@ -356,8 +352,7 @@ def main():
|
|||||||
collect_zones = list(set(specified_zones) & set(all_zones))
|
collect_zones = list(set(specified_zones) & set(all_zones))
|
||||||
ignore_zones = list(set(specified_zones) - set(collect_zones))
|
ignore_zones = list(set(specified_zones) - set(collect_zones))
|
||||||
if ignore_zones:
|
if ignore_zones:
|
||||||
warn.append(
|
module.warn(f'Please note: zone:({",".join(ignore_zones)}) have been ignored in the gathering process.')
|
||||||
'Please note: zone:(%s) have been ignored in the gathering process.' % ','.join(ignore_zones))
|
|
||||||
else:
|
else:
|
||||||
collect_zones = get_all_zones(client)
|
collect_zones = get_all_zones(client)
|
||||||
|
|
||||||
@@ -396,7 +391,6 @@ def main():
|
|||||||
result['collected_zones'] = collect_zones
|
result['collected_zones'] = collect_zones
|
||||||
result['undefined_zones'] = ignore_zones
|
result['undefined_zones'] = ignore_zones
|
||||||
result['firewalld_info'] = firewalld_info
|
result['firewalld_info'] = firewalld_info
|
||||||
result['warnings'] = warn
|
|
||||||
module.exit_json(**result)
|
module.exit_json(**result)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,6 @@
|
|||||||
---
|
---
|
||||||
# (c) 2017, Martin Krizek <mkrizek@redhat.com>
|
# (c) 2017, Martin Krizek <mkrizek@redhat.com>
|
||||||
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
- name: Create ansible user
|
- name: Create ansible user
|
||||||
ansible.builtin.user:
|
ansible.builtin.user:
|
||||||
@@ -43,15 +29,17 @@
|
|||||||
|
|
||||||
- name: Create ansible dir
|
- name: Create ansible dir
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ test_dir }}"
|
path: "{{ item.path }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: "0755"
|
mode: "{{ item.mode }}"
|
||||||
|
loop:
|
||||||
|
- { path: "{{ test_dir }}", mode: "0755" }
|
||||||
|
- { path: "{{ test_recursive_dir }}", mode: "0755" }
|
||||||
|
|
||||||
- name: Install acl package
|
- name: Install acl package
|
||||||
ansible.builtin.package:
|
ansible.builtin.package:
|
||||||
name: acl
|
name: acl
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
- name: Grant ansible user read access to a file
|
- name: Grant ansible user read access to a file
|
||||||
ansible.posix.acl:
|
ansible.posix.acl:
|
||||||
@@ -249,3 +237,38 @@
|
|||||||
- "'default:mask::rwx' in getfacl_output.stdout_lines"
|
- "'default:mask::rwx' in getfacl_output.stdout_lines"
|
||||||
- "'default:other::r-x' in getfacl_output.stdout_lines"
|
- "'default:other::r-x' in getfacl_output.stdout_lines"
|
||||||
- "'default:group:{{ test_group }}:rw-' not in getfacl_output.stdout_lines"
|
- "'default:group:{{ test_group }}:rw-' not in getfacl_output.stdout_lines"
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
- name: create file
|
||||||
|
ansible.builtin.copy:
|
||||||
|
dest: "{{ test_recursive_dir }}/txt.txt"
|
||||||
|
mode: '0440'
|
||||||
|
content: "hw"
|
||||||
|
|
||||||
|
- name: Change ACLs recursively
|
||||||
|
ansible.posix.acl:
|
||||||
|
path: "{{ test_recursive_dir }}"
|
||||||
|
entity: "{{ test_user }}"
|
||||||
|
etype: user
|
||||||
|
permissions: rX
|
||||||
|
state: present
|
||||||
|
recursive: true
|
||||||
|
register: output_acl_change
|
||||||
|
|
||||||
|
- name: Remove ACLs recursively again
|
||||||
|
ansible.posix.acl:
|
||||||
|
path: "{{ test_recursive_dir }}"
|
||||||
|
entity: "{{ test_user }}"
|
||||||
|
etype: user
|
||||||
|
permissions: r
|
||||||
|
state: present
|
||||||
|
recursive: true
|
||||||
|
register: output_acl_remove
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- output_acl_change is changed
|
||||||
|
- output_acl_change is not failed
|
||||||
|
- output_acl_remove is changed
|
||||||
|
- output_acl_remove is not failed
|
||||||
|
|||||||
@@ -1,20 +1,6 @@
|
|||||||
---
|
---
|
||||||
# (c) 2017, Martin Krizek <mkrizek@redhat.com>
|
# (c) 2017, Martin Krizek <mkrizek@redhat.com>
|
||||||
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
- name: Test ACL
|
- name: Test ACL
|
||||||
vars:
|
vars:
|
||||||
@@ -22,6 +8,7 @@
|
|||||||
test_group: ansible_group
|
test_group: ansible_group
|
||||||
test_file: "{{ output_dir }}/ansible file"
|
test_file: "{{ output_dir }}/ansible file"
|
||||||
test_dir: "{{ output_dir }}/ansible_dir/with some space"
|
test_dir: "{{ output_dir }}/ansible_dir/with some space"
|
||||||
|
test_recursive_dir: "{{ output_dir }}/recursive_dir"
|
||||||
block:
|
block:
|
||||||
- name: Include tests task file
|
- name: Include tests task file
|
||||||
ansible.builtin.include_tasks: acl.yml
|
ansible.builtin.include_tasks: acl.yml
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
- name: Assert turn active_zones true
|
- name: Assert turn active_zones true
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
|
- result.collected_zones == ['public']
|
||||||
|
|
||||||
- name: Ensure firewalld_zones with zone list
|
- name: Ensure firewalld_zones with zone list
|
||||||
ansible.posix.firewalld_info:
|
ansible.posix.firewalld_info:
|
||||||
@@ -31,3 +32,6 @@
|
|||||||
- name: Assert specified zones
|
- name: Assert specified zones
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
|
- result.collected_zones == ['public']
|
||||||
|
- result.undefined_zones == ['invalid_zone']
|
||||||
|
- '"invalid_zone" in result.warnings[0]'
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
tests/utils/shippable/check_matrix.py replace-urlopen
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
tests/utils/shippable/check_matrix.py replace-urlopen
|
|
||||||
Reference in New Issue
Block a user