At the time of creation of a task, 'expires_at' is not set by the controller leaving it for the executor to set it once the import succeeds or fails.
However, when a task is created via POST on /tasks, the json response returned contains 'expires_at' field with a non-None value. Ideally, 'expires_at' shouldn't be shown on the response returned by POST on /tasks.
Upon further investigation, we found the culprit to be ReponseSerializer of tasks resource.
At https://github.com/openstack/glance/blob/master/glance/api/v2/tasks.py#L220, 'task.expires_at' is going to be None right after a task is created. But, 'timeutils.isotime' upon getting a None argument, will return the current time. As a result, 'expires_at' is seen in the response with a non-None value.
Fix proposed to branch: master /review. openstack. org/65496
Review: https:/