Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_backup(self, backup_id):
try:
backup = persistence.get_backup(backup_id)
return str(backup)
except Exception, e:
msg = "Error while trying to get backup %s: %s" % (backup_id, e)
logger.error(msg)
logger.error(traceback.format_exc())
send_api_error("get-backup", e)
return error_response(msg)
def cancel_backup(self, backup_id):
backup = persistence.get_backup(backup_id)
if not backup:
raise BackupEngineError("Backup '%s' does not exist" % backup.id)
self._cancel_task(backup, self.backup_processor)
def get_backup_database_names(self, backup_id):
"""
Returns the list of databases available by specified backup
"""
backup = persistence.get_backup(backup_id)
if backup and backup.source_stats:
if "databaseName" in backup.source_stats:
return [backup.source_stats["databaseName"]]
elif "databaseStats" in backup.source_stats:
return backup.source_stats["databaseStats"].keys()
def expire_backup(self, backup_id):
try:
exp_man = self.backup_system.backup_expiration_manager
backup = persistence.get_backup(backup_id)
result = exp_man.expire_backup(backup, force=True)
return document_pretty_string(result)
except Exception, e:
msg = ("Error while trying to expire backup %s: %s" %
(backup_id, e))
logger.error(msg)
logger.error(traceback.format_exc())
send_api_error("expire-backup", e)
return error_response(msg)