Add raw copy support (raw=yes), tweak tempfile error message string.

This commit is contained in:
Michael DeHaan
2013-07-22 08:25:35 -04:00
parent 2e38d92262
commit c07dd07767
2 changed files with 31 additions and 7 deletions

View File

@@ -728,12 +728,15 @@ class Runner(object):
cmd += ' && echo %s' % basetmp
result = self._low_level_exec_command(conn, cmd, None, sudoable=False)
# error handling on this seems a little aggressive?
if result['rc'] != 0:
raise errors.AnsibleError('could not create temporary directory, SSH exited with result %d' % result['rc'])
raise errors.AnsibleError('could not create temporary directory, SSH (%s) exited with result %d' % (cmd, result['rc']))
rc = utils.last_non_blank_line(result['stdout']).strip() + '/'
# Catch any other failure conditions here; files should never be
# written directly to /.
if rc == '/':
# Catch failure conditions, files should never be
# written to locations in /.
if rc.startswith('/'):
raise errors.AnsibleError('failed to resolve remote temporary directory from %s: `%s` returned empty string' % (basetmp, cmd))
return rc