Improve check mode reporting for directories and file modes.

reviewable/pr18780/r1
Michael DeHaan 12 years ago
parent de74cfd85e
commit 151038471f

@ -196,12 +196,14 @@ def main():
if prev_state != 'absent' and state == 'absent': if prev_state != 'absent' and state == 'absent':
try: try:
if prev_state == 'directory': if prev_state == 'directory':
if os.path.islink(path):
if module.check_mode: if module.check_mode:
module.exit_json(changed=True) module.exit_json(changed=True)
if os.path.islink(path):
os.unlink(path) os.unlink(path)
else: else:
try: try:
if module.check_mode:
module.exit_json(changed=True)
shutil.rmtree(path, ignore_errors=False) shutil.rmtree(path, ignore_errors=False)
except: except:
module.exit_json(msg="rmtree failed") module.exit_json(msg="rmtree failed")

Loading…
Cancel
Save