trove/trove/module
Amrith Kumar 109ff94951 Handle isotime deprecation in oslo_utils.timeutils
oslo_utils.timeutils is deprecating isotime(). In reality they are
deprecating some other things as well but Trove doesn't (currently)
use any of those things.

Much has been written on the subject of this deprecation. I think the
proposal to merely replace isotime with datetime.datetime.isoformat()
is a little simplistic. Well intentioned, but nonetheless I believe
that it is simplistic.

The primary issue I could find with oslo_utils.timeutils.isotime() was
the fact that it was naive. I think it could well have been fixed in
oslo_utils but for whatever reason(s) oslo decided not to want to go
that route.

The primary challenge from Trove's perspective is that I want to
respect the existing API contract while at the same time get an
implementation of time handling that is not identical in its flaws
with oslo_utils.timeutils.isotime().

This change set attempts to address that by making
trove.common.timeutils.isotime() that is aware. It also implements a
utcnow_aware() function that is aware.

ISO 8601 allows for four representations of timezone and those are

<time>Z
<time>[+-]hh:mm
<time>[+-]hhmm
<time>[+-]hh

Trove conventionally used the first one, even if the time wasn't
really a UTC time. That's one of the things being fixed here.

In review cp16net asked whether this change removes the 'Z' at the end
of time strings generated by the isotime() function. The answer is
NO. The new isotime() function performs identical to the old and now
deprecated function in oslo_utils.timeutils for UTC (Z) times.

There was a utcnow() function in trove.common.utils which just wrapped
datetime.datetime.utcnow(). That has been moved now to
trove.common.timeutils with the other new time related functions.

There were a couple of places in Trove where code was using
datetime.now() which was not ideal. Those have been corrected now as
well.

Unit tests have been proposed for the new routines.

Closes-Bug: #1532120
Change-Id: Ic5abf6669edd4f1a9fd62e61f437565aa887aebe
2017-06-09 16:22:11 +00:00
..
__init__.py Server side of module maintenance commands 2016-02-25 11:10:51 -05:00
models.py Handle isotime deprecation in oslo_utils.timeutils 2017-06-09 16:22:11 +00:00
service.py Handle log message interpolation by the logger part 10 2017-06-06 16:03:27 +02:00
views.py Fix module-instances command 2017-02-27 18:42:34 +00:00