mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
Move connection plugins to using global display
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user