Sorry for the garbage code on the end. Cut and paste using ctrl-v on my
chromebook sometimes does some strange stuff in google groups, and the
option to edit ones own posts is not enable in this group (hint :) )
On Thursday, 21 May 2015 15:33:37 UTC+1, John McNulty wrote:
>
> 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/012a286f-e83a-417d-80b1-9f59ef3e782c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.