issue #396: fix compatibility with Connection._reset().

issue260
David Wilson 7 years ago
parent d280bba02b
commit 6107ebdc0d

@ -579,7 +579,7 @@ class Connection(ansible.plugins.connection.ConnectionBase):
self.host_vars = task_vars['hostvars'] self.host_vars = task_vars['hostvars']
self.delegate_to_hostname = delegate_to_hostname self.delegate_to_hostname = delegate_to_hostname
self.loader_basedir = loader_basedir self.loader_basedir = loader_basedir
self._reset(mode='put') self._mitogen_reset(mode='put')
def get_task_var(self, key, default=None): def get_task_var(self, key, default=None):
if self._task_vars and key in self._task_vars: if self._task_vars and key in self._task_vars:
@ -740,10 +740,10 @@ class Connection(ansible.plugins.connection.ConnectionBase):
def _reset_tmp_path(self): def _reset_tmp_path(self):
""" """
Called by _reset(); ask the remote context to delete any temporary Called by _mitogen_reset(); ask the remote context to delete any
directory created for the action. CallChain is not used here to ensure temporary directory created for the action. CallChain is not used here
exception is logged by the context on failure, since the CallChain to ensure exception is logged by the context on failure, since the
itself is about to be destructed. CallChain itself is about to be destructed.
""" """
if getattr(self._shell, 'tmpdir', None) is not None: if getattr(self._shell, 'tmpdir', None) is not None:
self.context.call_no_reply( self.context.call_no_reply(
@ -770,9 +770,11 @@ class Connection(ansible.plugins.connection.ConnectionBase):
stack = self._build_stack() stack = self._build_stack()
self._connect_stack(stack) self._connect_stack(stack)
def _reset(self, mode): def _mitogen_reset(self, mode):
""" """
Forget everything we know about the connected context. Forget everything we know about the connected context. This function
cannot be called _reset() since that name is used as a public API by
Ansible 2.4 wait_for_connection plug-in.
:param str mode: :param str mode:
Name of ContextService method to use to discard the context, either Name of ContextService method to use to discard the context, either
@ -815,7 +817,10 @@ class Connection(ansible.plugins.connection.ConnectionBase):
bad somehow, and should be shut down and discarded. bad somehow, and should be shut down and discarded.
""" """
self._connect() self._connect()
self._reset(mode='reset') self._mitogen_reset(mode='reset')
# Compatibility with Ansible 2.4 wait_for_connection plug-in.
_reset = reset
def get_chain(self, use_login=False, use_fork=False): def get_chain(self, use_login=False, use_fork=False):
""" """

Loading…
Cancel
Save