From 0fee1132ad408e34317ee60a6b5fd7f011d0aaee Mon Sep 17 00:00:00 2001 From: sysadmin75 Date: Sat, 13 Dec 2014 15:14:32 -0500 Subject: [PATCH] Fixes #9518 - "file state=directory" silently skips if it's currently a file --- files/file.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/files/file.py b/files/file.py index 7aa5e45d7bc..e154d6ad07f 100644 --- a/files/file.py +++ b/files/file.py @@ -240,6 +240,10 @@ def main(): tmp_file_args['path']=curpath changed = module.set_fs_attributes_if_different(tmp_file_args, changed) + # We already know prev_state is not 'absent', therefore it exists in some form. + elif prev_state != 'directory': + module.fail_json(path=path, msg='%s already exists as a %s' % (path, prev_state)) + changed = module.set_fs_attributes_if_different(file_args, changed) if recurse: