Make 'qvm-volume revert' really use the latest revision

admin.vm.volume.ListSnapshots returned volume revisions in undefined
order, but 'qvm-volume revert' assumes the list to be in chronological
order. Make that assumption true.
This commit is contained in:
Rusty Bird 2018-01-20 23:20:23 +00:00
parent bf1f1ac5ff
commit fe77b0ec85
No known key found for this signature in database
GPG Key ID: 469D78F47AAF2ADF

View File

@ -347,7 +347,8 @@ class QubesAdminAPI(qubes.api.AbstractQubesAPI):
assert self.arg in self.dest.volumes.keys()
volume = self.dest.volumes[self.arg]
revisions = [revision for revision in volume.revisions]
id_to_timestamp = volume.revisions
revisions = sorted(id_to_timestamp, key=id_to_timestamp.__getitem__)
revisions = self.fire_event_for_filter(revisions)
return ''.join('{}\n'.format(revision) for revision in revisions)