Commit 4e4ffa66 by Brian Coca Committed by James Cammarata

Correctly examine path for relative links in file module

Fixes #7515
Fixes #7537
parent ce80c0b8
......@@ -182,10 +182,11 @@ def main():
elif state in ['link','hard']:
absrc = src
if not os.path.isabs(absrc):
absrc = os.path.abspath(src)
if os.path.isdir(path):
relpath = path
else:
relpath = os.path.dirname(path)
absrc = os.path.normpath('%s/%s' % (relpath, os.path.basename(src)))
if not os.path.exists(absrc) and not force:
module.fail_json(path=path, src=src, msg='src file does not exist, use "force=yes" if you really want to create the link: %s' % absrc)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment