diff --git a/awx/main/models/events.py b/awx/main/models/events.py index 96172641f6..a71d91a6b2 100644 --- a/awx/main/models/events.py +++ b/awx/main/models/events.py @@ -423,6 +423,16 @@ class BasePlaybookEvent(CreatedModifiedModel): except (KeyError, ValueError): kwargs.pop('created', None) + # same as above, for job_created + # TODO: if this approach, identical to above, works, can convert to for loop + try: + if not isinstance(kwargs['job_created'], datetime.datetime): + kwargs['job_created'] = parse_datetime(kwargs['job_created']) + if not kwargs['job_created'].tzinfo: + kwargs['job_created'] = kwargs['job_created'].replace(tzinfo=utc) + except (KeyError, ValueError): + kwargs.pop('job_created', None) + host_map = kwargs.pop('host_map', {}) sanitize_event_keys(kwargs, cls.VALID_KEYS) diff --git a/awx/main/tasks.py b/awx/main/tasks.py index 6d5a774d23..46edabbbe3 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -1290,7 +1290,7 @@ class BaseTask(object): # TODO: can we count on instance always having created? # If we can't how can we store the job_event? - self.job_created = self.instance.created + self.job_created = str(self.instance.created) try: self.instance.send_notification_templates("running")