Allow 'cleanup' to run when no space is left
Be conservative and only unlock the 'cleanup' functionality, else we'd have to check that all other actions handle ENOSPC gracefully. Noticed at Concept Hygiene: https://assistance.tranquil.it/scp/tickets.php?id=2010
This commit is contained in:
		
							parent
							
								
									39859ffee1
								
							
						
					
					
						commit
						1bbea09f55
					
				
							
								
								
									
										13
									
								
								tisbackup.py
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								tisbackup.py
									
									
									
									
									
								
							@ -28,6 +28,7 @@ import sys
 | 
				
			|||||||
import getopt
 | 
					import getopt
 | 
				
			||||||
import os.path
 | 
					import os.path
 | 
				
			||||||
import logging
 | 
					import logging
 | 
				
			||||||
 | 
					import errno
 | 
				
			||||||
from libtisbackup.common import *
 | 
					from libtisbackup.common import *
 | 
				
			||||||
from libtisbackup.backup_mysql import backup_mysql
 | 
					from libtisbackup.backup_mysql import backup_mysql
 | 
				
			||||||
from libtisbackup.backup_rsync import backup_rsync
 | 
					from libtisbackup.backup_rsync import backup_rsync
 | 
				
			||||||
@ -369,9 +370,15 @@ def main():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    # if we run the nagios check, we don't create log file, everything is piped to stdout
 | 
					    # if we run the nagios check, we don't create log file, everything is piped to stdout
 | 
				
			||||||
    if action!='checknagios':
 | 
					    if action!='checknagios':
 | 
				
			||||||
        hdlr = logging.FileHandler(os.path.join(log_dir,'tisbackup_%s.log' % (backup_start_date)))
 | 
					        try:
 | 
				
			||||||
        hdlr.setFormatter(logging.Formatter('%(asctime)s %(levelname)s %(message)s'))
 | 
					            hdlr = logging.FileHandler(os.path.join(log_dir,'tisbackup_%s.log' % (backup_start_date)))
 | 
				
			||||||
        logger.addHandler(hdlr)
 | 
					            hdlr.setFormatter(logging.Formatter('%(asctime)s %(levelname)s %(message)s'))
 | 
				
			||||||
 | 
					            logger.addHandler(hdlr)
 | 
				
			||||||
 | 
					        except Exception, e:
 | 
				
			||||||
 | 
					            if action == 'cleanup' and e.errno == errno.ENOSPC:
 | 
				
			||||||
 | 
					                logger.warning("No space left on device, disabling file logging.")
 | 
				
			||||||
 | 
					            else:
 | 
				
			||||||
 | 
					                raise e
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Main
 | 
					    # Main
 | 
				
			||||||
    backup = tis_backup(dry_run=dry_run,verbose=verbose,backup_base_dir=backup_base_dir)
 | 
					    backup = tis_backup(dry_run=dry_run,verbose=verbose,backup_base_dir=backup_base_dir)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user