Commit d13ab9a0 authored by David Wilson's avatar David Wilson

ansible: remove hard-wired UNIX socket path.

parent 20afa5b9
......@@ -43,6 +43,7 @@ Enable it by:
"""
from __future__ import absolute_import
import os
import ansible.errors
import ansible.plugins.connection
......@@ -65,7 +66,9 @@ class Connection(ansible.plugins.connection.ConnectionBase):
if self.connected:
return
self.router, self.parent = mitogen.unix.connect('/tmp/mitosock')
path = os.environ['LISTENER_SOCKET_PATH']
self.router, self.parent = mitogen.unix.connect(path)
host = mitogen.service.call(self.parent, 500, {
'method': 'ssh',
'hostname': self._play_context.remote_addr,
......
......@@ -74,7 +74,9 @@ class StrategyModule(ansible.plugins.strategy.linear.StrategyModule):
def run(self, iterator, play_context, result=0):
self.router = mitogen.master.Router()
self.listener = mitogen.unix.Listener(self.router, path='/tmp/mitosock')
self.listener = mitogen.unix.Listener(self.router)
os.environ['LISTENER_SOCKET_PATH'] = self.listener.path
self.service = ContextProxyService(self.router)
mitogen.utils.log_to_file()
......@@ -97,3 +99,4 @@ class StrategyModule(ansible.plugins.strategy.linear.StrategyModule):
return super(StrategyModule, self).run(iterator, play_context)
finally:
self.router.broker.shutdown()
os.unlink(self.listener.path)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment