I’ve written a module that has requires a src and dest file. I’m puzzled as to how core modules like copy find their source files in the role//files directory. I’ve looked at the sources for copy.py and it just gets the source file from module.params[‘src’]. Then tests with:
if not os.path.exists(src): module.fail_json(msg="Source %s failed to transfer" % (src))
If I do the same I find it’s looking for the source file in my account home directory, so doesn’t find anything:
`
Sanity check the src file exists
if not os.path.exists(src):
module.fail_json( msg=‘src file does not exist: %s in %s’ % (src, os.getcwd()) )
`
resulting in:
failed: [localhost] => {“failed”: true}
msg: src file does not exist: eu-replay-dev in /home/jjmcnulty
It works fine with absolute path names, just not relative. What am I missing?
Thanks. John
if not os.path.exists(src):
module.fail_json(msg="Source %s failed to transfer" % (src))
if not os.path.exists(src):
module.fail_json(msg="Source %s failed to transfer" % (src))