Fixup error reporting.

pull/4420/head
Michael DeHaan 2013-07-22 08:35:31 -04:00
parent c07dd07767
commit e3f213e030
1 changed files with 5 additions and 2 deletions

View File

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