Hello,
This issue was discovered on Kolla train-centos8 images, but I assume
it applies to both Train and Ussuri for CentOS 8 in general, not just
to Kolla.
CloudKitty became timezone-aware in Train:
https://review.opendev.org/#/c/669192/
This code references tz.UTC from the dateutil library. However, this
was added only in dateutil 2.7.0, while train-centos8 Kolla images use
package python3-dateutil-2.6.1-6.el8.noarch.rpm, causing the error
captured at the end of this message [2].
I submitted a patch to raise the minimum requirement for dateutil in
cloudkitty:
https://review.opendev.org/#/c/742477/
However, how are those requirements taken into consideration when
packaging OpenStack in RDO? RDO packages for CentOS7 provide
python2-dateutil-2.8.0-1.el7.noarch.rpm, but there is no such package
in the CentOS8 repository.
Would it be better to just remove the use of tz.UTC? I believe we
could use dateutil.tz.tzutc() instead.
Thanks,
Pierre Riteau (priteau)
[1]
http://mirror.centos.org/centos/8/cloud/x86_64/openstack-train/Packages/p/
[2] Error trace below:
2020-07-22 16:33:11.207 26 ERROR wsme.api
[req-3c49884a-1412-42bb-a57e-e7c731360148
ef450a969a2945928d3ade785eaae860 19df0f36ede14c29be9ca476222f8ba9
default - -] Server-side error:
"module 'dateutil.tz' has no attribute 'UTC'". Detail:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/wsmeext/pecan.py", line 85,
in callfunction
result = f(self, *args, **kwargs)
File
"/usr/lib/python3.6/site-packages/cloudkitty/api/v1/controllers/storage.py",
line 71, in get_all
paginate=False)
File "/usr/lib/python3.6/site-packages/cloudkitty/storage/v2/influx.py",
line 311, in retrieve
begin, end = self._check_begin_end(begin, end)
File "/usr/lib/python3.6/site-packages/cloudkitty/storage/v2/influx.py",
line 271, in _check_begin_end
end = tzutils.get_next_month()
File "/usr/lib/python3.6/site-packages/cloudkitty/tzutils.py", line
150, in get_next_month
return add_delta(start, datetime.timedelta(days=month_days))
File "/usr/lib/python3.6/site-packages/cloudkitty/tzutils.py", line
104, in add_delta
return utc_to_local(local_to_utc(dt, naive=True) + delta)
File "/usr/lib/python3.6/site-packages/cloudkitty/tzutils.py", line
52, in local_to_utc
output = dt.astimezone(tz.UTC)
AttributeError: module 'dateutil.tz' has no attribute 'UTC'