mirror of
https://github.com/ansible/awx.git
synced 2026-03-03 17:51:06 -03:30
Merge pull request #4201 from cchurch/callback-shenanigans
Fix callback plugin issues
This commit is contained in:
@@ -28,9 +28,14 @@ import psutil
|
|||||||
|
|
||||||
__all__ = []
|
__all__ = []
|
||||||
|
|
||||||
|
main_pid = os.getpid()
|
||||||
|
|
||||||
|
|
||||||
@atexit.register
|
@atexit.register
|
||||||
def terminate_ssh_control_masters():
|
def terminate_ssh_control_masters():
|
||||||
|
# Only run this cleanup from the main process.
|
||||||
|
if os.getpid() != main_pid:
|
||||||
|
return
|
||||||
# Determine if control persist is being used and if any open sockets
|
# Determine if control persist is being used and if any open sockets
|
||||||
# exist after running the playbook.
|
# exist after running the playbook.
|
||||||
cp_path = os.environ.get('ANSIBLE_SSH_CONTROL_PATH', '')
|
cp_path = os.environ.get('ANSIBLE_SSH_CONTROL_PATH', '')
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ class EventContext(object):
|
|||||||
def get_end_dict(self):
|
def get_end_dict(self):
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def dump(self, fileobj, data, max_width=78):
|
def dump(self, fileobj, data, max_width=78, flush=False):
|
||||||
b64data = base64.b64encode(json.dumps(data))
|
b64data = base64.b64encode(json.dumps(data))
|
||||||
with self.display_lock:
|
with self.display_lock:
|
||||||
fileobj.write(u'\x1b[K')
|
fileobj.write(u'\x1b[K')
|
||||||
@@ -132,12 +132,14 @@ class EventContext(object):
|
|||||||
escaped_chunk = u'{}\x1b[{}D'.format(chunk, len(chunk))
|
escaped_chunk = u'{}\x1b[{}D'.format(chunk, len(chunk))
|
||||||
fileobj.write(escaped_chunk)
|
fileobj.write(escaped_chunk)
|
||||||
fileobj.write(u'\x1b[K')
|
fileobj.write(u'\x1b[K')
|
||||||
|
if flush:
|
||||||
|
fileobj.flush()
|
||||||
|
|
||||||
def dump_begin(self, fileobj):
|
def dump_begin(self, fileobj):
|
||||||
self.dump(fileobj, self.get_begin_dict())
|
self.dump(fileobj, self.get_begin_dict())
|
||||||
|
|
||||||
def dump_end(self, fileobj):
|
def dump_end(self, fileobj):
|
||||||
self.dump(fileobj, self.get_end_dict())
|
self.dump(fileobj, self.get_end_dict(), flush=True)
|
||||||
|
|
||||||
|
|
||||||
event_context = EventContext()
|
event_context = EventContext()
|
||||||
|
|||||||
Reference in New Issue
Block a user