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/<name>/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))

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1817dedb-d5c5-4a72-a0d2-431576717c4f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to