parent
1a0775a498
commit
bdba807fd1
2 changed files with 27 additions and 17 deletions
|
@ -161,12 +161,12 @@ class ActionBase:
|
||||||
if result['rc'] == 5:
|
if result['rc'] == 5:
|
||||||
output = 'Authentication failure.'
|
output = 'Authentication failure.'
|
||||||
elif result['rc'] == 255 and self._connection.transport in ('ssh',):
|
elif result['rc'] == 255 and self._connection.transport in ('ssh',):
|
||||||
# FIXME: more utils.VERBOSITY
|
|
||||||
#if utils.VERBOSITY > 3:
|
if self._connection_info.verbosity > 3:
|
||||||
# output = 'SSH encountered an unknown error. The output was:\n%s' % (result['stdout']+result['stderr'])
|
|
||||||
#else:
|
|
||||||
# output = 'SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue'
|
|
||||||
output = 'SSH encountered an unknown error. The output was:\n%s' % (result['stdout']+result['stderr'])
|
output = 'SSH encountered an unknown error. The output was:\n%s' % (result['stdout']+result['stderr'])
|
||||||
|
else:
|
||||||
|
output = 'SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue'
|
||||||
|
|
||||||
elif 'No space left on device' in result['stderr']:
|
elif 'No space left on device' in result['stderr']:
|
||||||
output = result['stderr']
|
output = result['stderr']
|
||||||
else:
|
else:
|
||||||
|
@ -462,7 +462,7 @@ class ActionBase:
|
||||||
err = stderr
|
err = stderr
|
||||||
|
|
||||||
debug("done with _low_level_execute_command() (%s)" % (cmd,))
|
debug("done with _low_level_execute_command() (%s)" % (cmd,))
|
||||||
if rc is not None:
|
if rc is None:
|
||||||
|
rc = 0
|
||||||
|
|
||||||
return dict(rc=rc, stdout=out, stderr=err)
|
return dict(rc=rc, stdout=out, stderr=err)
|
||||||
else:
|
|
||||||
return dict(stdout=out, stderr=err)
|
|
||||||
|
|
|
@ -398,14 +398,14 @@ class Connection(ConnectionBase):
|
||||||
|
|
||||||
super(Connection, self).put_file(in_path, out_path)
|
super(Connection, self).put_file(in_path, out_path)
|
||||||
|
|
||||||
self._display.vvv("PUT {0} TO {1}".format(in_path, out_path), host=self._connection_info.remote_addr)
|
# FIXME: make a function, used in all 3 methods EXEC/PUT/FETCH
|
||||||
|
host = self._connection_info.remote_addr
|
||||||
|
|
||||||
|
self._display.vvv("PUT {0} TO {1}".format(in_path, out_path), host=host)
|
||||||
if not os.path.exists(in_path):
|
if not os.path.exists(in_path):
|
||||||
raise AnsibleFileNotFound("file or module does not exist: {0}".format(in_path))
|
raise AnsibleFileNotFound("file or module does not exist: {0}".format(in_path))
|
||||||
cmd = self._password_cmd()
|
cmd = self._password_cmd()
|
||||||
|
|
||||||
# FIXME: make a function, used in all 3 methods EXEC/PUT/FETCH
|
|
||||||
host = self._connection_info.remote_addr
|
|
||||||
|
|
||||||
# FIXME: ipv6 stuff needs to be figured out. It's in the connection info, however
|
# FIXME: ipv6 stuff needs to be figured out. It's in the connection info, however
|
||||||
# not sure if it's all working yet so this remains commented out
|
# not sure if it's all working yet so this remains commented out
|
||||||
#if self._ipv6:
|
#if self._ipv6:
|
||||||
|
@ -436,12 +436,13 @@ class Connection(ConnectionBase):
|
||||||
|
|
||||||
super(Connection, self).fetch_file(in_path, out_path)
|
super(Connection, self).fetch_file(in_path, out_path)
|
||||||
|
|
||||||
self._display.vvv("FETCH {0} TO {1}".format(in_path, out_path), host=self._connection_info.remote_addr)
|
|
||||||
cmd = self._password_cmd()
|
|
||||||
|
|
||||||
# FIXME: make a function, used in all 3 methods EXEC/PUT/FETCH
|
# FIXME: make a function, used in all 3 methods EXEC/PUT/FETCH
|
||||||
host = self._connection_info.remote_addr
|
host = self._connection_info.remote_addr
|
||||||
|
|
||||||
|
self._display.vvv("FETCH {0} TO {1}".format(in_path, out_path), host=host)
|
||||||
|
cmd = self._password_cmd()
|
||||||
|
|
||||||
|
|
||||||
# FIXME: ipv6 stuff needs to be figured out. It's in the connection info, however
|
# FIXME: ipv6 stuff needs to be figured out. It's in the connection info, however
|
||||||
# not sure if it's all working yet so this remains commented out
|
# not sure if it's all working yet so this remains commented out
|
||||||
#if self._ipv6:
|
#if self._ipv6:
|
||||||
|
@ -467,5 +468,14 @@ class Connection(ConnectionBase):
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
''' not applicable since we're executing openssh binaries '''
|
''' not applicable since we're executing openssh binaries '''
|
||||||
|
|
||||||
|
if 'ControlMaster' in self._common_args:
|
||||||
|
cmd = ['ssh','-O','stop']
|
||||||
|
cmd.extend(self._common_args)
|
||||||
|
cmd.append(self._connection_info.remote_addr)
|
||||||
|
|
||||||
|
p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
stdout, stderr = p.communicate()
|
||||||
|
|
||||||
self._connected = False
|
self._connected = False
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue