Merge pull request #836 from sfromm/rawfixes
Fixes for raw module usage and failure to open_session()
This commit is contained in:
commit
a7415e5409
2 changed files with 12 additions and 3 deletions
|
@ -568,7 +568,9 @@ class Runner(object):
|
||||||
|
|
||||||
module_name = utils.template(self.module_name, inject)
|
module_name = utils.template(self.module_name, inject)
|
||||||
|
|
||||||
tmp = self._make_tmp_path(conn)
|
tmp = ''
|
||||||
|
if self.module_name != 'raw':
|
||||||
|
tmp = self._make_tmp_path(conn)
|
||||||
result = None
|
result = None
|
||||||
|
|
||||||
handler = getattr(self, "_execute_%s" % self.module_name, None)
|
handler = getattr(self, "_execute_%s" % self.module_name, None)
|
||||||
|
@ -595,7 +597,8 @@ class Runner(object):
|
||||||
|
|
||||||
del result.result['daisychain']
|
del result.result['daisychain']
|
||||||
|
|
||||||
self._delete_remote_files(conn, tmp)
|
if self.module_name != 'raw':
|
||||||
|
self._delete_remote_files(conn, tmp)
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
if not result.comm_ok:
|
if not result.comm_ok:
|
||||||
|
|
|
@ -84,7 +84,13 @@ class ParamikoConnection(object):
|
||||||
''' run a command on the remote host '''
|
''' run a command on the remote host '''
|
||||||
|
|
||||||
bufsize = 4096
|
bufsize = 4096
|
||||||
chan = self.ssh.get_transport().open_session()
|
try:
|
||||||
|
chan = self.ssh.get_transport().open_session()
|
||||||
|
except Exception, e:
|
||||||
|
msg = "Failed to open session"
|
||||||
|
if len(str(e)) > 0:
|
||||||
|
msg += ": %s" % str(e)
|
||||||
|
raise errors.AnsibleConnectionFailed(msg)
|
||||||
chan.get_pty()
|
chan.get_pty()
|
||||||
|
|
||||||
if not self.runner.sudo or not sudoable:
|
if not self.runner.sudo or not sudoable:
|
||||||
|
|
Loading…
Reference in a new issue