mirror of https://github.com/ansible/ansible.git
* Ensure we actually fallback to unsafe_writes when set to true add integration test add fix for get_url not passing the parameter from args (cherry picked from commitpull/73533/head932ba36160
) * Added clog missing for issue 70722 (#73175) (cherry picked from commitd6670da1d7
)
parent
e9c6b382ea
commit
148240099a
@ -0,0 +1,4 @@
|
||||
bugfixes:
|
||||
- Restored unsafe_writes functionality which was being skipped.
|
||||
- Added unsafe_writes test.
|
||||
- Enabled unsafe_writes for get_url which was ignoring the paramter.
|
@ -0,0 +1,6 @@
|
||||
needs/root
|
||||
skip/freebsd
|
||||
skip/osx
|
||||
skip/macos
|
||||
skip/aix
|
||||
shippable/posix/group3
|
@ -0,0 +1,53 @@
|
||||
- hosts: testhost
|
||||
gather_facts: false
|
||||
vars:
|
||||
testudir: '{{output_dir}}/unsafe_writes_test'
|
||||
testufile: '{{testudir}}/unreplacablefile.txt'
|
||||
tasks:
|
||||
- name: test unsafe_writes on immutable dir (file cannot be atomically replaced)
|
||||
block:
|
||||
- name: create target dir
|
||||
file: path={{testudir}} state=directory
|
||||
- name: setup test file
|
||||
copy: content=ORIGINAL dest={{testufile}}
|
||||
- name: make target dir immutable (cannot write to file w/o unsafe_writes)
|
||||
file: path={{testudir}} state=directory attributes="+i"
|
||||
become: yes
|
||||
ignore_errors: true
|
||||
register: madeimmutable
|
||||
|
||||
- name: only run if immutable dir command worked, some of our test systems don't allow for it
|
||||
when: madeimmutable is success
|
||||
block:
|
||||
- name: test this is actually immmutable working as we expect
|
||||
file: path={{testufile}} state=absent
|
||||
register: breakimmutable
|
||||
ignore_errors: True
|
||||
|
||||
- name: only run if reallyh immutable dir
|
||||
when: breakimmutable is failed
|
||||
block:
|
||||
- name: test overwriting file w/o unsafe
|
||||
copy: content=NEW dest={{testufile}} unsafe_writes=False
|
||||
ignore_errors: true
|
||||
register: copy_without
|
||||
|
||||
- name: ensure we properly failed
|
||||
assert:
|
||||
that:
|
||||
- copy_without is failed
|
||||
|
||||
- name: test overwriting file with unsafe
|
||||
copy: content=NEW dest={{testufile}} unsafe_writes=True
|
||||
register: copy_with
|
||||
|
||||
- name: ensure we properly changed
|
||||
assert:
|
||||
that:
|
||||
- copy_with is changed
|
||||
|
||||
always:
|
||||
- name: remove immutable flag from dir to prevent issues with cleanup
|
||||
file: path={{testudir}} state=directory attributes="-i"
|
||||
ignore_errors: true
|
||||
become: yes
|
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eux
|
||||
|
||||
ansible-playbook basic.yml -i ../../inventory -e "output_dir=${OUTPUT_DIR}" "$@"
|
Loading…
Reference in New Issue