Skip to content

Commit

Permalink
qvm-template: Fix timezone issues by storing timezone explictly in fe…
Browse files Browse the repository at this point in the history
…atures
  • Loading branch information
WillyPillow committed Sep 4, 2020
1 parent 5a1e1b7 commit 205eee4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions qubesadmin/tests/tools/qvm_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ def test_100_install_local_success(
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'),
Expand Down Expand Up @@ -280,8 +280,8 @@ def test_101_install_local_postprocargs_success(
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'),
Expand Down
5 changes: 3 additions & 2 deletions qubesadmin/tools/qvm_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -923,9 +923,10 @@ def verify(rpmfile, reponame):
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'] = \
Expand Down

0 comments on commit 205eee4

Please sign in to comment.