Created
May 14, 2011 21:38
-
-
Save abg/972666 to your computer and use it in GitHub Desktop.
holland divide-by-zero error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CheckForSpaceHook(BackupHook): | |
"""Check for available space before starting a backup""" | |
job_info = None | |
def execute(self, job, event): | |
"""Estimate the available space from the plugin and abort if | |
there does not appear to be enought to successfully complete this | |
backup based on the estimate. | |
:raises: BackupError if estimated_space > available_space | |
""" | |
if event == 'after-backup': | |
LOG.info("+ Final backup size %s", format_bytes(job.store.size())) | |
LOG.info("+ %.2f%% of estimated size %s ", | |
100.0*job.store.size() / | |
parse_bytes(self.job_info['estimated-size']), | |
self.job_info['estimated-size']) | |
LOG.info("+ Suggested estimated-size-factor = %.2f", | |
float(job.store.size()) / | |
parse_bytes(self.job_info['estimated-size'])) | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment