Skip to content
This repository has been archived by the owner on Jul 28, 2021. It is now read-only.

Bad retention values throw an exception #13

Closed
martinb3 opened this issue Jan 10, 2017 · 0 comments
Closed

Bad retention values throw an exception #13

martinb3 opened this issue Jan 10, 2017 · 0 comments

Comments

@martinb3
Copy link
Contributor

Per @zeus-cervantes, using 1 month for retention causes a stack trace:

unsupported type for timedelta seconds component: NoneType: TypeError
Traceback (most recent call last):
File "/var/task/lambdas.py", line 98, in lambda_snapshot
message_json['region'])
File "/var/task/ebs_snapper/snapshot.py", line 90, in perform_snapshot
retention, frequency = utils.parse_snapshot_settings(snapshot_settings)
File "/var/task/ebs_snapper/utils.py", line 187, in parse_snapshot_settings
retention = timedelta(seconds=retention_seconds)
TypeError: unsupported type for timedelta seconds component: NoneType

It seems this is due to wroberts/pytimeparse#13. "1 month" is apparently ambiguous and not originally supported due to that. Support for it was added later, but doesn't seem to be working.

We should handle the error better (maybe parse the settings when they're set, to validate them) as well as add support for "1 month" by switching to either a better implementation or getting a fix in pytimeparse.

martinb3 added a commit that referenced this issue Feb 13, 2017
Be sure we test the configurations before saving, in case we stumble upon any formatting issues or parsing errors due to ambiguous periods (e.g. '1 month' vs. '30 days') for retention.

Fixes #13.
martinb3 added a commit that referenced this issue Feb 13, 2017
Be sure we test the configurations before saving, in case we stumble upon any formatting issues or parsing errors due to ambiguous periods (e.g. '1 month' vs. '30 days') for retention.

Fixes #13.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant