* Make acl module to work with whitespaces in path
* Added a changelog fragment
* Add quotes to changelog fragment
(cherry picked from commit 504d76e956
)
This commit is contained in:
parent
02f45f45d7
commit
b327e1e2c6
4 changed files with 16 additions and 14 deletions
2
changelogs/fragments/63280-fix_acl_spaces_in_path.yml
Normal file
2
changelogs/fragments/63280-fix_acl_spaces_in_path.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- "acl - fixed module failure if there are spaces in a path"
|
|
@ -190,10 +190,10 @@ def build_command(module, mode, path, follow, default, recursive, recalculate_ma
|
|||
'''Builds and returns a getfacl/setfacl command.'''
|
||||
if mode == 'set':
|
||||
cmd = [module.get_bin_path('setfacl', True)]
|
||||
cmd.append('-m "%s"' % entry)
|
||||
cmd.extend(['-m', entry])
|
||||
elif mode == 'rm':
|
||||
cmd = [module.get_bin_path('setfacl', True)]
|
||||
cmd.append('-x "%s"' % entry)
|
||||
cmd.extend(['-x', entry])
|
||||
else: # mode == 'get'
|
||||
cmd = [module.get_bin_path('getfacl', True)]
|
||||
# prevents absolute path warnings and removes headers
|
||||
|
@ -241,7 +241,7 @@ def acl_changed(module, cmd):
|
|||
def run_acl(module, cmd, check_rc=True):
|
||||
|
||||
try:
|
||||
(rc, out, err) = module.run_command(' '.join(cmd), check_rc=check_rc)
|
||||
(rc, out, err) = module.run_command(cmd, check_rc=check_rc)
|
||||
except Exception as e:
|
||||
module.fail_json(msg=to_native(e))
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
register: output
|
||||
|
||||
- name: get getfacl output
|
||||
shell: "getfacl {{ test_file }}"
|
||||
shell: "getfacl {{ test_file | quote }}"
|
||||
register: getfacl_output
|
||||
|
||||
- name: verify output
|
||||
|
@ -60,7 +60,7 @@
|
|||
register: output
|
||||
|
||||
- name: get getfacl output
|
||||
shell: "getfacl {{ test_file }}"
|
||||
shell: "getfacl {{ test_file | quote }}"
|
||||
register: getfacl_output
|
||||
|
||||
- name: verify output
|
||||
|
@ -88,7 +88,7 @@
|
|||
register: output
|
||||
|
||||
- name: get getfacl output
|
||||
shell: "getfacl {{ test_file }}"
|
||||
shell: "getfacl {{ test_file | quote }}"
|
||||
register: getfacl_output
|
||||
|
||||
- name: verify output
|
||||
|
@ -110,7 +110,7 @@
|
|||
register: output
|
||||
|
||||
- name: get getfacl output
|
||||
shell: "getfacl {{ test_dir }}"
|
||||
shell: "getfacl {{ test_dir | quote }}"
|
||||
register: getfacl_output
|
||||
|
||||
- name: verify output
|
||||
|
@ -122,7 +122,7 @@
|
|||
- "'default:user:{{ test_user }}:rw-' in getfacl_output.stdout_lines"
|
||||
##############################################################################
|
||||
- name: Cleanup
|
||||
shell: "setfacl -b {{ test_dir }}"
|
||||
shell: "setfacl -b {{ test_dir | quote }}"
|
||||
##############################################################################
|
||||
- name: Same as previous but using entry shorthand
|
||||
acl:
|
||||
|
@ -133,7 +133,7 @@
|
|||
register: output
|
||||
|
||||
- name: get getfacl output
|
||||
shell: "getfacl {{ test_dir }}"
|
||||
shell: "getfacl {{ test_dir | quote }}"
|
||||
register: getfacl_output
|
||||
|
||||
- name: verify output
|
||||
|
@ -153,7 +153,7 @@
|
|||
register: output
|
||||
|
||||
- name: get getfacl output
|
||||
shell: "getfacl {{ test_dir }}"
|
||||
shell: "getfacl {{ test_dir | quote }}"
|
||||
register: getfacl_output
|
||||
|
||||
- name: verify output
|
||||
|
@ -165,7 +165,7 @@
|
|||
- "'default:user:{{ test_user }}:rw-' in getfacl_output.stdout_lines"
|
||||
##############################################################################
|
||||
- name: Cleanup
|
||||
shell: "setfacl -b {{ test_dir }}"
|
||||
shell: "setfacl -b {{ test_dir | quote }}"
|
||||
##############################################################################
|
||||
- name: Set default acls
|
||||
acl:
|
||||
|
@ -186,7 +186,7 @@
|
|||
register: output
|
||||
|
||||
- name: get getfacl output
|
||||
shell: "getfacl {{ test_dir }}"
|
||||
shell: "getfacl {{ test_dir | quote }}"
|
||||
register: getfacl_output
|
||||
|
||||
- name: verify output
|
||||
|
|
|
@ -32,5 +32,5 @@
|
|||
vars:
|
||||
test_user: ansible_user
|
||||
test_group: ansible_group
|
||||
test_file: /tmp/ansible_file
|
||||
test_dir: /tmp/ansible_dir
|
||||
test_file: '{{ output_dir }}/ansible file'
|
||||
test_dir: "{{ output_dir }}/ansible_dir/with some space"
|
||||
|
|
Loading…
Reference in a new issue