1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 01:21:21 +03:00

Include hostname in the event data at the top level if it's available

This commit is contained in:
Matthew Jones 2014-05-02 10:34:42 -04:00
parent 5fa351040a
commit bc7567a341
3 changed files with 5 additions and 2 deletions

View File

@ -85,6 +85,7 @@ def process_job_event(data):
data.pop(key)
data['play'] = data.get('event_data', {}).get('play', '').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):
try:
if event == 'playbook_on_stats':

View File

@ -262,14 +262,13 @@ def run_taskmanager(command_port):
paused = False
task_capacity = get_system_task_capacity()
command_context = zmq.Context()
command_socket = command_context.socket(zmq.REP)
command_socket = command_context.socket(zmq.PULL)
command_socket.bind(command_port)
print("Listening on %s" % command_port)
last_rebuild = datetime.datetime.fromtimestamp(0)
while True:
try:
message = command_socket.recv_json(flags=zmq.NOBLOCK)
command_socket.send("1")
except zmq.ZMQError,e:
message = None
if message is not None or (datetime.datetime.now() - last_rebuild).seconds > 10:

View File

@ -479,6 +479,9 @@ class JobEvent(CreatedModifiedModel):
on_delete=models.SET_NULL,
editable=False,
)
host_name = models.CharField(
max_length=1024,
default='')
hosts = models.ManyToManyField(
'Host',
related_name='job_events',