2018-04-17 11:42:53 +00:00
|
|
|
"""
|
|
|
|
Arrange for all ContextService connections to be torn down unconditionally,
|
|
|
|
required for reliable LRU tests.
|
|
|
|
"""
|
|
|
|
|
|
|
|
import traceback
|
|
|
|
import sys
|
|
|
|
|
2018-05-04 16:38:49 +00:00
|
|
|
import ansible_mitogen.connection
|
2018-04-17 11:42:53 +00:00
|
|
|
import ansible_mitogen.services
|
|
|
|
import mitogen.service
|
|
|
|
|
|
|
|
from ansible.plugins.strategy import StrategyBase
|
|
|
|
from ansible.plugins.action import ActionBase
|
|
|
|
|
|
|
|
|
|
|
|
class ActionModule(ActionBase):
|
|
|
|
def run(self, tmp=None, task_vars=None):
|
2018-05-04 16:38:49 +00:00
|
|
|
if not isinstance(self._connection,
|
|
|
|
ansible_mitogen.connection.Connection):
|
2018-04-18 14:30:31 +00:00
|
|
|
return {
|
2018-05-04 16:38:49 +00:00
|
|
|
'skipped': True,
|
2018-04-18 14:30:31 +00:00
|
|
|
}
|
|
|
|
|
2018-04-17 11:42:53 +00:00
|
|
|
self._connection._connect()
|
|
|
|
return {
|
|
|
|
'changed': True,
|
|
|
|
'result': mitogen.service.call(
|
|
|
|
context=self._connection.parent,
|
|
|
|
handle=ansible_mitogen.services.ContextService.handle,
|
|
|
|
method='shutdown_all',
|
|
|
|
kwargs={}
|
|
|
|
)
|
|
|
|
}
|