Skip to content

Commit

Permalink
fix: fix deletelist.sort for python 3
Browse files Browse the repository at this point in the history
fixes:

Traceback (most recent call last):
  File "./makesnapshots.py", line 197, in <module>
    deletelist.sort(date_compare)
  • Loading branch information
tomyam1 committed Jan 9, 2021
1 parent f84618a commit 4d1089f
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions makesnapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,10 @@ def set_resource_tags(resource, tags):
logging.info(snap)
logging.info(snap.start_time)

def date_compare(snap1, snap2):
if snap1.start_time < snap2.start_time:
return -1
elif snap1.start_time == snap2.start_time:
return 0
return 1

deletelist.sort(date_compare)
def date_key(snap):
return snap.start_time

deletelist.sort(key=date_key)
if period == 'day':
keep = keep_day
elif period == 'week':
Expand Down

0 comments on commit 4d1089f

Please sign in to comment.