From 0d8104b8b765f9760d666155f375f41c774a5a5c Mon Sep 17 00:00:00 2001 From: telsacolton Date: Wed, 14 May 2014 16:31:20 -0500 Subject: [PATCH 1/2] Give reasonable error when symlink fails When a symlink fails because the path already exists and force=no, we should output path in the error message instead of source. --- library/files/file | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/files/file b/library/files/file index c861d14a1a4..ddce2e558ff 100644 --- a/library/files/file +++ b/library/files/file @@ -201,7 +201,7 @@ def main(): module.fail_json(msg="absolute paths are required") elif prev_state == 'directory': if not force: - module.fail_json(path=path, msg='refusing to convert between %s and %s for %s' % (prev_state, state, src)) + module.fail_json(path=path, msg='refusing to convert between %s and %s for %s' % (prev_state, state, path)) elif len(os.listdir(path)) > 0: # refuse to replace a directory that has files in it module.fail_json(path=path, msg='the directory %s is not empty, refusing to convert it' % path) From 06963c78261ea6a90a145327df0deca9fea2f3c1 Mon Sep 17 00:00:00 2001 From: telsacolton Date: Wed, 14 May 2014 16:54:26 -0500 Subject: [PATCH 2/2] Make file hardlink error message reasonble When we hard-link a file, and the link path already exists, give the link path in the error message instead of the source --- library/files/file | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/files/file b/library/files/file index ddce2e558ff..4ba61f6d531 100644 --- a/library/files/file +++ b/library/files/file @@ -206,7 +206,7 @@ def main(): # refuse to replace a directory that has files in it module.fail_json(path=path, msg='the directory %s is not empty, refusing to convert it' % path) elif prev_state in ['file', 'hard'] and not force: - module.fail_json(path=path, msg='refusing to convert between %s and %s for %s' % (prev_state, state, src)) + module.fail_json(path=path, msg='refusing to convert between %s and %s for %s' % (prev_state, state, path)) if prev_state == 'absent': changed = True