ansible/ansible — pull request #1804 by dagwieers (2012-12-25 04:25:19+00:00)
Title: Collate commands in a single ssh roundtrip and check return code where possible

Related to PR #1748 and #1800 I looked into all possible calls to `_low_level_exec_command()` and tried to collate as many as possible:

- async: Moving one chmod up to exec_module() and collate
- copy: Test return code and stderr output
- script: Test return code and stderr output
- template: Test return code and stderr output
- exec_module(): Collate sudo chmod into one single roundtrip to run module
- _remote_md5(): Test return code and stdout, add stderr to debugging
- _remote_md5(): simplify code
- _make_tmp_path(): Test return code and stderr
- all: clean up imports

If one of the (preparation) command fails, we get a proper error:
```
TASK: [copy src=test31.yml dest=/tmp/test31.yml] *********************
fatal: [localhost] => FAILED: mkdir: cannot create directory `/root/.ansible/tmp/ansible-1356408824.92-182593391072662': Permission denied
```

This patch set requires the pty patch set to enforce stdout/stderr separation.