mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 13:50:22 -07:00
Allow persistent connection plugins to queue messages back to ansible-connection (#49977)
* Connections can queue messages to be returned from ansible-connection * Provide fallback for invalid display level * Strip display from plugins * Route messages through helper method to try to avoid improper appends
This commit is contained in:
parent
49993a55e5
commit
1829a72885
13 changed files with 75 additions and 83 deletions
|
@ -25,7 +25,6 @@ from functools import wraps
|
|||
from ansible.plugins import AnsiblePlugin
|
||||
from ansible.errors import AnsibleError, AnsibleConnectionFailure
|
||||
from ansible.module_utils._text import to_bytes, to_text
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from scp import SCPClient
|
||||
|
@ -33,8 +32,6 @@ try:
|
|||
except ImportError:
|
||||
HAS_SCP = False
|
||||
|
||||
display = Display()
|
||||
|
||||
|
||||
def enable_mode(func):
|
||||
@wraps(func)
|
||||
|
@ -88,7 +85,7 @@ class CliconfBase(AnsiblePlugin):
|
|||
|
||||
def _alarm_handler(self, signum, frame):
|
||||
"""Alarm handler raised in case of command timeout """
|
||||
display.display('closing shell due to command timeout (%s seconds).' % self._connection._play_context.timeout, log_only=True)
|
||||
self._connection.queue_message('log', 'closing shell due to command timeout (%s seconds).' % self._connection._play_context.timeout)
|
||||
self.close()
|
||||
|
||||
def send_command(self, command=None, prompt=None, answer=None, sendonly=False, newline=True, prompt_retry_check=False, check_all=False):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue