mirror of
https://github.com/ansible/awx.git
synced 2026-05-11 19:37:38 -02:30
Include hostname in the event data at the top level if it's available
This commit is contained in:
@@ -85,6 +85,7 @@ def process_job_event(data):
|
|||||||
data.pop(key)
|
data.pop(key)
|
||||||
data['play'] = data.get('event_data', {}).get('play', '').strip()
|
data['play'] = data.get('event_data', {}).get('play', '').strip()
|
||||||
data['task'] = data.get('event_data', {}).get('task', '').strip()
|
data['task'] = data.get('event_data', {}).get('task', '').strip()
|
||||||
|
data['host_name'] = data.get('event_data', {}).get('host', '').strip()
|
||||||
for retry_count in xrange(11):
|
for retry_count in xrange(11):
|
||||||
try:
|
try:
|
||||||
if event == 'playbook_on_stats':
|
if event == 'playbook_on_stats':
|
||||||
|
|||||||
@@ -262,14 +262,13 @@ def run_taskmanager(command_port):
|
|||||||
paused = False
|
paused = False
|
||||||
task_capacity = get_system_task_capacity()
|
task_capacity = get_system_task_capacity()
|
||||||
command_context = zmq.Context()
|
command_context = zmq.Context()
|
||||||
command_socket = command_context.socket(zmq.REP)
|
command_socket = command_context.socket(zmq.PULL)
|
||||||
command_socket.bind(command_port)
|
command_socket.bind(command_port)
|
||||||
print("Listening on %s" % command_port)
|
print("Listening on %s" % command_port)
|
||||||
last_rebuild = datetime.datetime.fromtimestamp(0)
|
last_rebuild = datetime.datetime.fromtimestamp(0)
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
message = command_socket.recv_json(flags=zmq.NOBLOCK)
|
message = command_socket.recv_json(flags=zmq.NOBLOCK)
|
||||||
command_socket.send("1")
|
|
||||||
except zmq.ZMQError,e:
|
except zmq.ZMQError,e:
|
||||||
message = None
|
message = None
|
||||||
if message is not None or (datetime.datetime.now() - last_rebuild).seconds > 10:
|
if message is not None or (datetime.datetime.now() - last_rebuild).seconds > 10:
|
||||||
|
|||||||
@@ -479,6 +479,9 @@ class JobEvent(CreatedModifiedModel):
|
|||||||
on_delete=models.SET_NULL,
|
on_delete=models.SET_NULL,
|
||||||
editable=False,
|
editable=False,
|
||||||
)
|
)
|
||||||
|
host_name = models.CharField(
|
||||||
|
max_length=1024,
|
||||||
|
default='')
|
||||||
hosts = models.ManyToManyField(
|
hosts = models.ManyToManyField(
|
||||||
'Host',
|
'Host',
|
||||||
related_name='job_events',
|
related_name='job_events',
|
||||||
|
|||||||
Reference in New Issue
Block a user