ResponseSerializer shows incorrect 'expires_at' on a task at the time of creation

Bug #1267148 reported by Hemanth Makkapati
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Medium
Hemanth Makkapati

Bug Description

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.

Changed in glance:
assignee: nobody → Hemanth Makkapati (hemanth-makkapati)
Changed in glance:
status: New → Triaged
importance: Undecided → Medium
Changed in glance:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

Fix proposed to branch: master
Review: https://review.openstack.org/65496

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/65496
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=124048535d9c9c8dc6d527b4a73a5f84a25585f4
Submitter: Jenkins
Branch: master

commit 124048535d9c9c8dc6d527b4a73a5f84a25585f4
Author: Hemanth Makkapati <email address hidden>
Date: Wed Jan 8 10:56:43 2014 -0500

    Makes 'expires_at' not appear if not set on task

    Fixes bug: 1267148

    'expires_at' on a task must be set only after the executor succeeds or
    fails on a task. Before the task has finished, there shouldn't be any
    'expires_at' set on the task. This change fixes the ResponseSerializer
    to not show 'expires_at' if it is not set.

    Change-Id: I9880cc03b9d6f0dd98388fcf0d1bdc9c34dd6c0e

Changed in glance:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in glance:
milestone: none → icehouse-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in glance:
milestone: icehouse-2 → 2014.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.