Skip to content

Commit

Permalink
send adhoc command events to the external job_event logger
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanpetrello authored and rebeccahhh committed Sep 3, 2019
1 parent 7cba68c commit d87c838
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion awx/main/models/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,14 +614,23 @@ def create_from_data(cls, **kwargs):
kwargs.pop('created', None)

sanitize_event_keys(kwargs, cls.VALID_KEYS)
return cls.objects.create(**kwargs)
event = cls.objects.create(**kwargs)
if isinstance(event, AdHocCommandEvent):
analytics_logger.info(
'Event data saved.',
extra=dict(python_objects=dict(job_event=event))
)
return event

def get_event_display(self):
'''
Needed for __unicode__
'''
return self.event

def get_event_display2(self):
return self.get_event_display()

def get_host_status_counts(self):
return create_host_status_counts(getattr(self, 'event_data', {}))

Expand Down

0 comments on commit d87c838

Please sign in to comment.