mirror of
https://github.com/ansible/awx.git
synced 2026-02-27 07:56:06 -03:30
Convert job_created to string for serialization
This commit is contained in:
@@ -423,6 +423,16 @@ class BasePlaybookEvent(CreatedModifiedModel):
|
|||||||
except (KeyError, ValueError):
|
except (KeyError, ValueError):
|
||||||
kwargs.pop('created', None)
|
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', {})
|
host_map = kwargs.pop('host_map', {})
|
||||||
|
|
||||||
sanitize_event_keys(kwargs, cls.VALID_KEYS)
|
sanitize_event_keys(kwargs, cls.VALID_KEYS)
|
||||||
|
|||||||
@@ -1290,7 +1290,7 @@ class BaseTask(object):
|
|||||||
|
|
||||||
# TODO: can we count on instance always having created?
|
# TODO: can we count on instance always having created?
|
||||||
# If we can't how can we store the job_event?
|
# 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:
|
try:
|
||||||
self.instance.send_notification_templates("running")
|
self.instance.send_notification_templates("running")
|
||||||
|
|||||||
Reference in New Issue
Block a user