From 151038471fab8e6f839b9e3c7dd1d7f94a20df11 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Sat, 11 May 2013 15:04:42 -0400 Subject: [PATCH] Improve check mode reporting for directories and file modes. --- files/file | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/files/file b/files/file index 6cb51a33cff..ed957819eb4 100644 --- a/files/file +++ b/files/file @@ -196,12 +196,14 @@ def main(): if prev_state != 'absent' and state == 'absent': try: if prev_state == 'directory': - if module.check_mode: - module.exit_json(changed=True) if os.path.islink(path): + if module.check_mode: + module.exit_json(changed=True) os.unlink(path) else: try: + if module.check_mode: + module.exit_json(changed=True) shutil.rmtree(path, ignore_errors=False) except: module.exit_json(msg="rmtree failed")