Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"ValueError: hour must be in 0..23" Error #12

Closed
robbinscp opened this issue Jul 31, 2018 · 2 comments
Closed

"ValueError: hour must be in 0..23" Error #12

robbinscp opened this issue Jul 31, 2018 · 2 comments

Comments

@robbinscp
Copy link

robbinscp commented Jul 31, 2018

I have a weird issue when running rotate-backups via CLI. The directory I have specified has backups from about 6 months ago; the CLI command looks like this -

rotate-backups -r -v --hourly=0 --include="*.tar.gz" --daily 3 --weekly 4 --monthly 3 --dry-run $PATH

The error I get is as follows -

 2018-07-31 18:06:51 142851cc0396 rotate_backups.cli[9] INFO Performing a dry run (because of --dry-run option) ..
 2018-07-31 18:06:51 142851cc0396 rotate_backups.cli[9] VERBOSE Rotation scheme defined on command line: {'monthly': 3, 'hourly': 0, 'daily': 7, 'weekly': 4}
 2018-07-31 18:06:51 142851cc0396 rotate_backups.cli[9] VERBOSE Selected 1 location based on command line arguments:
 2018-07-31 18:06:51 142851cc0396 rotate_backups.cli[9] VERBOSE  1. /rotate/dsquad/backups/test-rotate/cassandra
 2018-07-31 18:06:51 142851cc0396 rotate_backups[9] VERBOSE No configuration found for /rotate/dsquad/backups/test-rotate/cassandra.
 2018-07-31 18:06:51 142851cc0396 rotate_backups[9] INFO Scanning /rotate/dsquad/backups/test-rotate/cassandra for backups ..
 Traceback (most recent call last):
   File "/usr/bin/rotate-backups", line 11, in <module>
     sys.exit(main())
   File "/usr/lib/python2.7/site-packages/rotate_backups/cli.py", line 287, in main
     program.rotate_backups(location)
   File "/usr/lib/python2.7/site-packages/rotate_backups/__init__.py", line 442, in rotate_backups
     sorted_backups = self.collect_backups(location)
   File "/usr/lib/python2.7/site-packages/rotate_backups/__init__.py", line 540, in collect_backups
     timestamp=datetime.datetime(*(int(group, 10) for group in match.groups('0'))),
 ValueError: hour must be in 0..23
@robbinscp
Copy link
Author

I think I've sorted part of this out - can the include option filter on dates? In my environment, I have files that are as follows -

  • snapshot-180731150101.tar.gz

I've passed "snapshot-*.tar.gz", which gives me the above result. If I pass a formatted option to include (i.e. - "snapshot-%y%m%d%H%M%S.tar.gz"), it ignores the files in the directory as they don't match the string.

@xolox
Copy link
Owner

xolox commented Aug 2, 2018

Thanks for the feedback @robbinscp. Starting from release 6.0 which I just published, filenames with invalid dates are ignored (and a log message is emitted to alert the user to what is happening). I hope this helps.

@xolox xolox closed this as completed Aug 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants