1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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.
This commit is contained in:
telsacolton 2014-05-14 16:31:20 -05:00
parent 79731ce491
commit 0d8104b8b7

View file

@ -201,7 +201,7 @@ def main():
module.fail_json(msg="absolute paths are required") module.fail_json(msg="absolute paths are required")
elif prev_state == 'directory': elif prev_state == 'directory':
if not force: 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: elif len(os.listdir(path)) > 0:
# refuse to replace a directory that has files in it # 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) module.fail_json(path=path, msg='the directory %s is not empty, refusing to convert it' % path)