Fix to mariadb backup script

Handle cases where no full backup exists from which to take an
incremental backup from.

Change-Id: Ifde912e98bd71f78ffedcd2daae0bca2208a6045
This commit is contained in:
Georgina Shippey 2020-11-17 10:56:39 +00:00
parent 258470a89a
commit d0ca870fdf
1 changed files with 4 additions and 2 deletions

View File

@ -139,8 +139,10 @@ def create_increment_backup(dest, curtime, increment_backup_filename, extra_mari
get_lock_file()
try:
basedir = max([ os.path.normpath(dest+'/'+f) for f in os.listdir(dest) if f.startswith('mariabackup-')], key=os.path.getmtime)
except(OSError):
basedir="./"
except ValueError:
print("No full backup found, cannot create incremental backup.")
os.unlink("/var/run/db_backup.pid")
raise SystemExit(1)
try:
err = open(os.path.normpath(dest+"/increment.err"), "w")
#Creating incremental backup