Container GET request returning inconsistent timestamp formatting

Bug #798268 reported by Juan J. Martínez on 2011-06-16
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Juan J. Martínez

Bug Description

swift 1.4.1 (trunk) is affected.

Probably it's not completely clear, but according to following examples:

"last_modified" field should always have the format: %Y-%m-%dT%H:%M:%S.%f

The container server is using datetime.datetime.isoformat() to format the timestamp in the JSON output and that function actually doesn't show the milliseconds part if it's zero.

So you can get an output like:

>>> for i in cont.list_objects_info():
... print i['name'], i['last_modified']
21fa54e9fc6d46639a8dc71010d94bbe.txt 2011-06-16T11:30:48.785630
220135ad5ddf4873bb2ad6697af53667.txt 2011-06-16T11:32:21.515170
22411202895a4304815ccb5d571420e4.txt 2011-06-16T11:34:40.322250
2275efcbb6154b1b86f40f3f68f09921.txt 2011-06-16T11:24:57
228a43c827c7476f99fadd65f874596c.txt 2011-06-16T12:12:55.756650

Which doesn't seem right in the case of 2275efcbb6154b1b86f40f3f68f09921.txt (it has 0 miliseconds, so it should end .000000).

This is probably a bug, either in the documentation (it should specify if the .%f part is optional) or in the container server.

description: updated
Changed in swift:
assignee: nobody → Juan J. Martínez (jjmartinez)
status: New → Confirmed

Fix proposed to branch: master

Changed in swift:
status: Confirmed → In Progress

Submitter: Jenkins
Branch: master

commit bb3bfe1dbd25a1cfc59320902cca88959f586a2e
Author: Juan J. Martinez <email address hidden>
Date: Thu Feb 2 11:54:15 2012 +0000

    Consistent timestamp formatting for last_modified.

    Fixes bug 798268.

    Python datetime's isoformat() uses %Y-%m-%dT%H:%M:%S.%f format, but
    the miliseconds part is not included when it's zero.

    As consequence the compliant ISO 8601 format was not consistent
    when performing a GET request over a container (listing objects info).

    Change-Id: Ifed3f0adf3eaca47304c142615169bd3f1901631

Changed in swift:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2012-02-09
Changed in swift:
milestone: none → 1.4.6
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers