Skip to content
Permalink
Browse files

Remove microseconds before time format conversion.

Updates Glance scrubber so that it chops microseconds off of the
date format before parsing a time format string. This fixes
an exceptions that can occur when using scrubber with databases
like PostgreSQL which include microseconds in date strings.

Fixes LP Bug #1022369.

Change-Id: I2e9eb66052d8ce34438a4c1ba7a5174cc2385bcf
  • Loading branch information...
dprince authored and bcwaldon committed Jul 8, 2012
1 parent e20e2c8 commit 5fa9821cd2f03e85a1662efdf100b6438d20a39d
Showing with 4 additions and 1 deletion.
  1. +4 −1 glance/store/scrubber.py
@@ -160,7 +160,10 @@ def _cleanup(self, pool):
continue

time_fmt = "%Y-%m-%dT%H:%M:%S"
delete_time = calendar.timegm(time.strptime(deleted_at,
# NOTE: Strip off microseconds which may occur after the last '.,'
# Example: 2012-07-07T19:14:34.974216
date_str = deleted_at.rsplit('.', 1)[0].rsplit(',', 1)[0]
delete_time = calendar.timegm(time.strptime(date_str,
time_fmt))

if delete_time + self.cleanup_time > now:

0 comments on commit 5fa9821

Please sign in to comment.
You can’t perform that action at this time.