Ok, thanks, I commented on the pull request. It will be very useful to have shell options.
https://github.com/mpdehaan/ansible/pull/92
One thought I have is that rather than the modules having dual behavior (inline+args file) it may be better if
we supply a scripts/test_module script that does the magic, that way we’re getting more full coverage
when testing the module directly. This also keeps the module source shorter, which is an important point of
showing how easy they are to write. We would not ship the test_module script but it could be used in development.
Another thought – Rather than duplicating the module source in ‘shell’, wouldn’t it be better to maybe teach runner
to know that “shell” meant to deploy the command module and that the command module gets
executed in some slightly ‘special’ way such that it knows to use the shell behavior? That
way there’s one less module file to maintain. I didn’t see the commit for ‘shell’ but suspect that module
is only minimally different. That would be good. There is already some larger magic around ‘copy’ and ‘template’
in runner, this feels like smaller magic. We could just add a special option to the arguments that it would know
how to read and then strip off before running the command.
I can look at getting setup/async & async_wrapper operational with this tonight, as well
as doing some more module testing.
Generally “make tests” is pretty good for exercising all of these and should be run
when making module changes. I need to add some easy (i.e. non-side effect) tests for
the yum module if the distribution is Red Hat (aka if redhat-release exists or whatever). Probably
will just run list-available to make sure syntax of the module is still ok and some basics. It is good to make sure
new modules generally update the test suite.
Thinking out loud, Is there a decent way to write the args file remotely without using the local tempfile?
I would think you could use the ssh libraries and open up cat with a pipe. Might be nice, as so far we
don’t create temp files on the local box.
We could make a method in connection called put_file_string or equivalent? I may look
into this as well.
In any event, I’ll merge this to my private branch tonight and explore some things.
This is a very good feature.
(OT – I’m overdue for some more extensive refactoring in Runner to remove some very procedural artifacts
of me building it the first time. Should make things easier/nicer to maintain)
–Michael