summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Coca <brian.coca+git@gmail.com>2015-01-07 13:16:53 -0500
committerJames Cammarata <jimi@sngx.net>2015-02-17 14:45:08 -0600
commitcec0e7b15075e950e15f5dec0be0075baa80a635 (patch)
treef07538793d960779ebc1dc8a98abd42bcfee7c0a
parent90b296b482132d79f4b6393d05c7c818df76c065 (diff)
downloadansible-modules-core-cec0e7b15075e950e15f5dec0be0075baa80a635.tar.gz
fix for allowing permissions on hard links and soft links + follow=yes
-rw-r--r--files/file.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/files/file.py b/files/file.py
index 002776fd..35bb52ab 100644
--- a/files/file.py
+++ b/files/file.py
@@ -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))