I've possibly found a bug, but I would like to confirm before creating a ticket.
I'm trying to capture output of a remote script executed using the 'script' module. If sudo is not enabled, everything works just fine and I can use result.stdout. However, if sudo is enabled, sudo "success_key" is embedded into result.stdout if I'm using the script module. The same problem do not affect 'command' module.
This was tested with ansible 1.4.3 (pip), as well as the development version from git. It used to work just fine with ansible 1.3.4.
Might be specific to the script module and the way it’s implemented, but yes, this seems bug-ish.
Please report this one on github even if you don’t get a chance to dive in.
I would probably look to see what’s normally absorbing this message and why it doesn’t in the script module case, provided you can see this behavior on the development branch.
One of my colleagues just ran into this same thing on 1.4.4. It looks like the script module is picking up the results of sudo and claiming success no matter what the script actually claims.
I’ll report this issue on github tomorrow morning if Luciano hasn’t.
A little poking finds that lib/ansible/utils/init.py is the only place that uses SUDO-SUCCESS and then only in make_sudo_cmd. That function is called in a lot of connection_plugins files. I can’t work out how the script module is implemented based on a cursory look because it is not like any of the other modules I have looked at.