qvm-template: Fix timezone issues by storing timezone explictly in features

This commit is contained in:
WillyPillow 2020-09-05 01:51:45 +08:00
parent 5a1e1b7fdd
commit 205eee4d80
No known key found for this signature in database
GPG Key ID: 3839E194B1415A9C
2 changed files with 7 additions and 6 deletions

View File

@ -149,8 +149,8 @@ class TC_00_qvm_template(qubesadmin.tests.QubesTestCase):
mock_rename,
mock_remove):
self.app.expected_calls[('dom0', 'admin.vm.List', None, None)] = b'0\0'
build_time = '2020-09-01 22:30:00' # 1598970600
install_time = '2020-09-01 23:30:00.508230'
build_time = '2020-09-01 14:30:00+00:00' # 1598970600
install_time = '2020-09-01 15:30:00.508230+00:00'
for key, val in [
('name', 'test-vm'),
('epoch', '2'),
@ -280,8 +280,8 @@ class TC_00_qvm_template(qubesadmin.tests.QubesTestCase):
mock_rename,
mock_remove):
self.app.expected_calls[('dom0', 'admin.vm.List', None, None)] = b'0\0'
build_time = '2020-09-01 22:30:00' # 1598970600
install_time = '2020-09-01 23:30:00.508230'
build_time = '2020-09-01 14:30:00+00:00' # 1598970600
install_time = '2020-09-01 15:30:00.508230+00:00'
for key, val in [
('name', 'test-vm'),
('epoch', '2'),

View File

@ -923,9 +923,10 @@ def install(
tpl.features['template-reponame'] = reponame
tpl.features['template-buildtime'] = \
str(datetime.datetime.fromtimestamp(
int(package_hdr[rpm.RPMTAG_BUILDTIME])))
int(package_hdr[rpm.RPMTAG_BUILDTIME]),
tz=datetime.timezone.utc))
tpl.features['template-installtime'] = \
str(datetime.datetime.today())
str(datetime.datetime.today(tz=datetime.timezone.utc))
tpl.features['template-license'] = \
package_hdr[rpm.RPMTAG_LICENSE]
tpl.features['template-url'] = \