mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 18:40:01 -03:30
Convert job_created to string for serialization
This commit is contained in:
parent
c0d38e91f5
commit
1af1a5e9da
@ -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)
|
||||
|
||||
@ -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")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user