|
|
|
|
@ -145,7 +145,7 @@ def _connect_ssh(spec):
|
|
|
|
|
'identity_file': private_key_file,
|
|
|
|
|
'identities_only': False,
|
|
|
|
|
'ssh_path': spec.ssh_executable(),
|
|
|
|
|
'connect_timeout': spec.ansible_ssh_timeout(),
|
|
|
|
|
'connect_timeout': spec.timeout(),
|
|
|
|
|
'ssh_args': spec.ssh_args(),
|
|
|
|
|
'ssh_debug_level': spec.mitogen_ssh_debug_level(),
|
|
|
|
|
'remote_name': get_remote_name(spec),
|
|
|
|
|
@ -169,7 +169,7 @@ def _connect_buildah(spec):
|
|
|
|
|
'username': spec.remote_user(),
|
|
|
|
|
'container': spec.remote_addr(),
|
|
|
|
|
'python_path': spec.python_path(),
|
|
|
|
|
'connect_timeout': spec.ansible_ssh_timeout() or spec.timeout(),
|
|
|
|
|
'connect_timeout': spec.timeout(),
|
|
|
|
|
'remote_name': get_remote_name(spec),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -185,7 +185,7 @@ def _connect_docker(spec):
|
|
|
|
|
'username': spec.remote_user(),
|
|
|
|
|
'container': spec.remote_addr(),
|
|
|
|
|
'python_path': spec.python_path(rediscover_python=True),
|
|
|
|
|
'connect_timeout': spec.ansible_ssh_timeout() or spec.timeout(),
|
|
|
|
|
'connect_timeout': spec.timeout(),
|
|
|
|
|
'remote_name': get_remote_name(spec),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -200,7 +200,7 @@ def _connect_kubectl(spec):
|
|
|
|
|
'kwargs': {
|
|
|
|
|
'pod': spec.remote_addr(),
|
|
|
|
|
'python_path': spec.python_path(),
|
|
|
|
|
'connect_timeout': spec.ansible_ssh_timeout() or spec.timeout(),
|
|
|
|
|
'connect_timeout': spec.timeout(),
|
|
|
|
|
'kubectl_path': spec.mitogen_kubectl_path(),
|
|
|
|
|
'kubectl_args': spec.extra_args(),
|
|
|
|
|
'remote_name': get_remote_name(spec),
|
|
|
|
|
@ -218,7 +218,7 @@ def _connect_jail(spec):
|
|
|
|
|
'username': spec.remote_user(),
|
|
|
|
|
'container': spec.remote_addr(),
|
|
|
|
|
'python_path': spec.python_path(),
|
|
|
|
|
'connect_timeout': spec.ansible_ssh_timeout() or spec.timeout(),
|
|
|
|
|
'connect_timeout': spec.timeout(),
|
|
|
|
|
'remote_name': get_remote_name(spec),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -234,7 +234,7 @@ def _connect_lxc(spec):
|
|
|
|
|
'container': spec.remote_addr(),
|
|
|
|
|
'python_path': spec.python_path(),
|
|
|
|
|
'lxc_attach_path': spec.mitogen_lxc_attach_path(),
|
|
|
|
|
'connect_timeout': spec.ansible_ssh_timeout() or spec.timeout(),
|
|
|
|
|
'connect_timeout': spec.timeout(),
|
|
|
|
|
'remote_name': get_remote_name(spec),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -250,7 +250,7 @@ def _connect_lxd(spec):
|
|
|
|
|
'container': spec.remote_addr(),
|
|
|
|
|
'python_path': spec.python_path(),
|
|
|
|
|
'lxc_path': spec.mitogen_lxc_path(),
|
|
|
|
|
'connect_timeout': spec.ansible_ssh_timeout() or spec.timeout(),
|
|
|
|
|
'connect_timeout': spec.timeout(),
|
|
|
|
|
'remote_name': get_remote_name(spec),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -273,7 +273,7 @@ def _connect_podman(spec):
|
|
|
|
|
'username': spec.remote_user(),
|
|
|
|
|
'container': spec.remote_addr(),
|
|
|
|
|
'python_path': spec.python_path(rediscover_python=True),
|
|
|
|
|
'connect_timeout': spec.ansible_ssh_timeout() or spec.timeout(),
|
|
|
|
|
'connect_timeout': spec.timeout(),
|
|
|
|
|
'remote_name': get_remote_name(spec),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -933,31 +933,39 @@ class Connection(ansible.plugins.connection.ConnectionBase):
|
|
|
|
|
self.reset_compat_msg
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Strategy's _execute_meta doesn't have an action obj but we'll need one for
|
|
|
|
|
# running interpreter_discovery
|
|
|
|
|
# will create a new temporary action obj for this purpose
|
|
|
|
|
self._action = ansible_mitogen.mixins.ActionModuleMixin(
|
|
|
|
|
task=0,
|
|
|
|
|
connection=self,
|
|
|
|
|
play_context=self._play_context,
|
|
|
|
|
loader=0,
|
|
|
|
|
templar=0,
|
|
|
|
|
shared_loader_obj=0
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Workaround for https://github.com/ansible/ansible/issues/84238
|
|
|
|
|
# Handle templated connection variables during `meta: reset_connection`.
|
|
|
|
|
# Many bugs/implementation details of Mitogen & Ansible collide here.
|
|
|
|
|
# See #1079, #1096, #1132, ansible/ansible#84238, ...
|
|
|
|
|
try:
|
|
|
|
|
task, templar = self._play_context.vars.pop(
|
|
|
|
|
'_mitogen.smuggled.reset_connection',
|
|
|
|
|
)
|
|
|
|
|
except KeyError:
|
|
|
|
|
pass
|
|
|
|
|
self._action_monkey_patched_by_mitogen = False
|
|
|
|
|
else:
|
|
|
|
|
# LOG.info('%r.reset(): remote_addr=%r', self, self._play_context.remote_addr)
|
|
|
|
|
# ansible.plugins.strategy.StrategyBase._execute_meta() doesn't
|
|
|
|
|
# have an action object, which we need for interpreter_discovery.
|
|
|
|
|
# Create a temporary action object for this purpose.
|
|
|
|
|
self._action = ansible_mitogen.mixins.ActionModuleMixin(
|
|
|
|
|
task=task,
|
|
|
|
|
connection=self,
|
|
|
|
|
play_context=self._play_context,
|
|
|
|
|
loader=templar._loader,
|
|
|
|
|
templar=templar,
|
|
|
|
|
shared_loader_obj=0,
|
|
|
|
|
)
|
|
|
|
|
self._action_monkey_patched_by_mitogen = True
|
|
|
|
|
|
|
|
|
|
# Workaround for https://github.com/ansible/ansible/issues/84238
|
|
|
|
|
self.set_options(
|
|
|
|
|
task_keys=task.dump_attrs(),
|
|
|
|
|
var_options=self._mitogen_var_options(templar),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
del task
|
|
|
|
|
del templar
|
|
|
|
|
|
|
|
|
|
# Clear out state in case we were ever connected.
|
|
|
|
|
self.close()
|
|
|
|
|
|
|
|
|
|
@ -977,6 +985,11 @@ class Connection(ansible.plugins.connection.ConnectionBase):
|
|
|
|
|
finally:
|
|
|
|
|
binding.close()
|
|
|
|
|
|
|
|
|
|
# Cleanup any monkey patching we did for `meta: reset_connection`
|
|
|
|
|
if self._action_monkey_patched_by_mitogen:
|
|
|
|
|
del self._action
|
|
|
|
|
del self._action_monkey_patched_by_mitogen
|
|
|
|
|
|
|
|
|
|
# Compatibility with Ansible 2.4 wait_for_connection plug-in.
|
|
|
|
|
_reset = reset
|
|
|
|
|
|
|
|
|
|
|