How to use the persistence.get_backup function in Persistence

To help you get started, we’ve selected a few Persistence examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mongolab / mongodb-backup-system / mbs / api.py View on Github external
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)
github mongolab / mongodb-backup-system / mbs / engine.py View on Github external
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)
github mongolab / mongodb-backup-system / mbs / backup_system.py View on Github external
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()
github mongolab / mongodb-backup-system / mbs / api.py View on Github external
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)