mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 14:40:19 -07:00
Move connection plugins to using global display
This commit is contained in:
parent
318bfbb207
commit
aa4f213cb5
11 changed files with 192 additions and 131 deletions
|
@ -22,7 +22,6 @@ __metaclass__ = type
|
|||
|
||||
import fcntl
|
||||
import gettext
|
||||
import select
|
||||
import os
|
||||
from abc import ABCMeta, abstractmethod, abstractproperty
|
||||
|
||||
|
@ -68,6 +67,7 @@ class ConnectionBase(with_metaclass(ABCMeta, object)):
|
|||
self._play_context = play_context
|
||||
if not hasattr(self, '_new_stdin'):
|
||||
self._new_stdin = new_stdin
|
||||
# Backwards compat: self._display isn't really needed, just import the global display and use that.
|
||||
if not hasattr(self, '_display'):
|
||||
self._display = display
|
||||
if not hasattr(self, '_connected'):
|
||||
|
@ -220,11 +220,11 @@ class ConnectionBase(with_metaclass(ABCMeta, object)):
|
|||
|
||||
def connection_lock(self):
|
||||
f = self._play_context.connection_lockfd
|
||||
self._display.vvvv('CONNECTION: pid %d waiting for lock on %d' % (os.getpid(), f))
|
||||
display.vvvv('CONNECTION: pid %d waiting for lock on %d' % (os.getpid(), f))
|
||||
fcntl.lockf(f, fcntl.LOCK_EX)
|
||||
self._display.vvvv('CONNECTION: pid %d acquired lock on %d' % (os.getpid(), f))
|
||||
display.vvvv('CONNECTION: pid %d acquired lock on %d' % (os.getpid(), f))
|
||||
|
||||
def connection_unlock(self):
|
||||
f = self._play_context.connection_lockfd
|
||||
fcntl.lockf(f, fcntl.LOCK_UN)
|
||||
self._display.vvvv('CONNECTION: pid %d released lock on %d' % (os.getpid(), f))
|
||||
display.vvvv('CONNECTION: pid %d released lock on %d' % (os.getpid(), f))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue