mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
* fixed pamd single line issue
* added changelog fragment
* supported case for 0 lines, improved test
(cherry picked from commit a3a40f6de3
)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
34f963e2f4
commit
acc77182bb
4 changed files with 72 additions and 4 deletions
5
tests/integration/targets/pamd/aliases
Normal file
5
tests/integration/targets/pamd/aliases
Normal file
|
@ -0,0 +1,5 @@
|
|||
shippable/posix/group1
|
||||
skip/aix
|
||||
skip/freebsd
|
||||
skip/osx
|
||||
skip/macos
|
56
tests/integration/targets/pamd/tasks/main.yml
Normal file
56
tests/integration/targets/pamd/tasks/main.yml
Normal file
|
@ -0,0 +1,56 @@
|
|||
# (c) 2021, Alexei Znamensky
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
- name: Set value for temp limit configuration
|
||||
set_fact:
|
||||
test_pamd_file: "/tmp/pamd_file"
|
||||
|
||||
- name: Copy temporary pam.d file
|
||||
copy:
|
||||
content: "session required pam_lastlog.so silent showfailed"
|
||||
dest: "{{ test_pamd_file }}"
|
||||
|
||||
- name: Test working on a single-line file works (2925)
|
||||
community.general.pamd:
|
||||
path: /tmp
|
||||
name: pamd_file
|
||||
type: session
|
||||
control: required
|
||||
module_path: pam_lastlog.so
|
||||
module_arguments: silent
|
||||
state: args_absent
|
||||
register: pamd_file_output
|
||||
|
||||
- name: Check if changes made
|
||||
assert:
|
||||
that:
|
||||
- pamd_file_output is changed
|
||||
|
||||
- name: Copy temporary pam.d file
|
||||
copy:
|
||||
content: ""
|
||||
dest: "{{ test_pamd_file }}"
|
||||
|
||||
# This test merely demonstrates that, as-is, module will not perform any changes on an empty file
|
||||
# All the existing values for "state" will first search for a rule matching type, control, module_path
|
||||
# and will not perform any change whatsoever if no existing rules match.
|
||||
- name: Test working on a empty file works (2925)
|
||||
community.general.pamd:
|
||||
path: /tmp
|
||||
name: pamd_file
|
||||
type: session
|
||||
control: required
|
||||
module_path: pam_lastlog.so
|
||||
module_arguments: silent
|
||||
register: pamd_file_output_empty
|
||||
|
||||
- name: Read back the file
|
||||
slurp:
|
||||
src: "{{ test_pamd_file }}"
|
||||
register: pamd_file_slurp
|
||||
|
||||
- name: Check if changes made
|
||||
assert:
|
||||
that:
|
||||
- pamd_file_output_empty is not changed
|
||||
- pamd_file_slurp.content|b64decode == ''
|
Loading…
Add table
Add a link
Reference in a new issue