mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-14 20:29:11 -07:00
parent
e428441a1d
commit
e2164c5378
1 changed files with 9 additions and 2 deletions
|
@ -197,7 +197,10 @@ def split_pre_existing_dir(dirname):
|
||||||
head, tail = os.path.split(dirname)
|
head, tail = os.path.split(dirname)
|
||||||
b_head = to_bytes(head, errors='surrogate_or_strict')
|
b_head = to_bytes(head, errors='surrogate_or_strict')
|
||||||
if not os.path.exists(b_head):
|
if not os.path.exists(b_head):
|
||||||
(pre_existing_dir, new_directory_list) = split_pre_existing_dir(head)
|
if head == dirname:
|
||||||
|
return None, [head]
|
||||||
|
else:
|
||||||
|
(pre_existing_dir, new_directory_list) = split_pre_existing_dir(head)
|
||||||
else:
|
else:
|
||||||
return head, [tail]
|
return head, [tail]
|
||||||
new_directory_list.append(tail)
|
new_directory_list.append(tail)
|
||||||
|
@ -209,7 +212,11 @@ def adjust_recursive_directory_permissions(pre_existing_dir, new_directory_list,
|
||||||
Walk the new directories list and make sure that permissions are as we would expect
|
Walk the new directories list and make sure that permissions are as we would expect
|
||||||
'''
|
'''
|
||||||
if new_directory_list:
|
if new_directory_list:
|
||||||
working_dir = os.path.join(pre_existing_dir, new_directory_list.pop(0))
|
first_sub_dir = new_directory_list.pop(0)
|
||||||
|
if not pre_existing_dir:
|
||||||
|
working_dir = first_sub_dir
|
||||||
|
else:
|
||||||
|
working_dir = os.path.join(pre_existing_dir, first_sub_dir)
|
||||||
directory_args['path'] = working_dir
|
directory_args['path'] = working_dir
|
||||||
changed = module.set_fs_attributes_if_different(directory_args, changed)
|
changed = module.set_fs_attributes_if_different(directory_args, changed)
|
||||||
changed = adjust_recursive_directory_permissions(working_dir, new_directory_list, module, directory_args, changed)
|
changed = adjust_recursive_directory_permissions(working_dir, new_directory_list, module, directory_args, changed)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue