Commit 1b3d1125 by Michael DeHaan

Merge pull request #3531 from fractalcat/tmpdir-failure-handling

Handle SSH failures when creating remote tmpdir
parents 90c8dcc4 690048c7
......@@ -700,7 +700,16 @@ class Runner(object):
cmd += ' && echo %s' % basetmp
result = self._low_level_exec_command(conn, cmd, None, sudoable=False)
if result['rc'] != 0:
raise errors.AnsibleError('could not create temporary directory: '
'SSH exited with return code %d' % 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 == '/':
raise errors.AnsibleError('failed to resolve remote temporary '
'directory from %s: `%s` returned '
'empty string' % (basetmp, cmd))
return rc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment