ansible: disable interpreter recycling for connections.
Must explicitly specify enable_lru=True in ContextService.get() to trigger recycling.
This commit is contained in:
parent
ec22fee7a7
commit
b0309b539c
|
@ -134,6 +134,7 @@ def _connect_setns(spec):
|
|||
def _connect_sudo(spec):
|
||||
return {
|
||||
'method': 'sudo',
|
||||
'enable_lru': True,
|
||||
'kwargs': {
|
||||
'username': spec['become_user'],
|
||||
'password': spec['become_pass'],
|
||||
|
|
|
@ -167,7 +167,7 @@ class ContextService(mitogen.service.Service):
|
|||
del self._response_by_key[key]
|
||||
del self._refs_by_context[context]
|
||||
del self._key_by_context[context]
|
||||
if lru:
|
||||
if lru and context in lru:
|
||||
lru.remove(context)
|
||||
if new_context:
|
||||
lru.append(new_context)
|
||||
|
@ -256,7 +256,7 @@ class ContextService(mitogen.service.Service):
|
|||
raise Error('unsupported method: %(transport)s' % spec)
|
||||
|
||||
context = method(via=via, **spec['kwargs'])
|
||||
if via:
|
||||
if via and spec.get('enable_lru'):
|
||||
self._update_lru(context, spec, via)
|
||||
else:
|
||||
# For directly connected contexts, listen to the associated
|
||||
|
|
|
@ -213,10 +213,6 @@ container.
|
|||
as duplicate connections between hops, due to not perfectly replicating
|
||||
the configuration Ansible would normally use for the intermediary.
|
||||
|
||||
* The extension does not understand the difference between a delegated
|
||||
connection and a ``become_user``. If interpreter recycling kicks in, a
|
||||
delegated connection could be prematurely recycled.
|
||||
|
||||
To enable connection delegation, set ``mitogen_via=<inventory name>`` on the
|
||||
command line, or as host and group variables.
|
||||
|
||||
|
|
Loading…
Reference in New Issue