You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If deltas include M (month) or Y (year), the service will crash as it is unable to sort the values. For example, using deltas: P1D P1W P1M P1Y will result in an error.
The appears to be because isodate uses a datetime.timedelta object for hours, days, and weeks - but uses a Duration object for months and years. deltas=[datetime.timedelta(1), datetime.timedelta(7), isodate.duration.Duration(0, 0, 0, years=0, months=1), isodate.duration.Duration(0, 0, 0, years=1, months=0)]
A workaround is to just use days or weeks to represent months/years (P30D/P365D), but being able to use the Month or Year designations would make the rules more readable.
At minimum, catching these values and throwing an understandable error would be helpful.
Full error:
2018-02-06T17:10:34.555553Z Unhandled exception in main task [k8s_snapshots.__main__] loop=<_UnixSelectorEventLoop running=False closed=False debug=False> main_task=<Task finished coro=<daemon() done, defined at /usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/core.py:444> exception=TypeError("'<' not supported between instances of 'Duration' and 'datetime.timedelta'",)> message=Unhandled exception in main task severity=ERROR
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/__main__.py", line 58, in main
loop.run_until_complete(main_task)
File "/usr/local/lib/python3.6/asyncio/base_events.py", line 467, in run_until_complete
return future.result()
File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/core.py", line 469, in daemon
await asyncio.gather(*tasks)
File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/core.py", line 438, in backuper
await make_backup(ctx, current_target_rule)
File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/snapshot.py", line 148, in make_backup
await expire_snapshots(ctx, rule)
File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/snapshot.py", line 39, in expire_snapshots
to_keep = expire(snapshots_with_date, rule.deltas)
File "/usr/local/lib/python3.6/site-packages/tarsnapper/expire.py", line 57, in expire
deltas.sort()
TypeError: '<' not supported between instances of 'Duration' and 'datetime.timedelta'
2018-02-06T17:10:34.565667Z Shutdown complete [k8s_snapshots.__main__] message=Shutdown complete severity=INFO
Traceback (most recent call last):
File "/usr/local/bin/k8s-snapshots", line 11, in <module>
load_entry_point('k8s-snapshots==0.0.0', 'console_scripts', 'k8s-snapshots')()
File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/__main__.py", line 58, in main
File "/usr/local/lib/python3.6/asyncio/base_events.py", line 467, in run_until_complete
return future.result()
File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/core.py", line 469, in daemon
File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/core.py", line 438, in backuper
File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/snapshot.py", line 148, in make_backup
File "/usr/local/lib/python3.6/site-packages/k8s_snapshots-0.0.0-py3.6.egg/k8s_snapshots/snapshot.py", line 39, in expire_snapshots
File "/usr/local/lib/python3.6/site-packages/tarsnapper/expire.py", line 57, in expire
deltas.sort()
TypeError: '<' not supported between instances of 'Duration' and 'datetime.timedelta'
The text was updated successfully, but these errors were encountered:
If deltas include M (month) or Y (year), the service will crash as it is unable to sort the values. For example, using
deltas: P1D P1W P1M P1Y
will result in an error.The appears to be because isodate uses a datetime.timedelta object for hours, days, and weeks - but uses a Duration object for months and years.
deltas=[datetime.timedelta(1), datetime.timedelta(7), isodate.duration.Duration(0, 0, 0, years=0, months=1), isodate.duration.Duration(0, 0, 0, years=1, months=0)]
A workaround is to just use days or weeks to represent months/years (P30D/P365D), but being able to use the Month or Year designations would make the rules more readable.
At minimum, catching these values and throwing an understandable error would be helpful.
Full error:
The text was updated successfully, but these errors were encountered: