mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
fix for allowing permissions on hard links and soft links + follow=yes
This commit is contained in:
parent
e75dc7e5a6
commit
a3de4db57d
1 changed files with 8 additions and 0 deletions
|
@ -218,7 +218,15 @@ def main():
|
|||
module.exit_json(path=path, changed=False)
|
||||
|
||||
elif state == 'file':
|
||||
|
||||
if state != prev_state:
|
||||
if follow and prev_state == 'link':
|
||||
# follow symlink and operate on original
|
||||
path = os.readlink(path)
|
||||
prev_state = get_state(path)
|
||||
file_args['path'] = path
|
||||
|
||||
if prev_state not in ['file','hard']:
|
||||
# file is not absent and any other state is a conflict
|
||||
module.fail_json(path=path, msg='file (%s) is %s, cannot continue' % (path, prev_state))
|
||||
|
||||
|
|
Loading…
Reference in a new issue