def estimate_backup_size(self): try: client = MySQL.from_defaults(self.defaults_path) except MySQL.MySQLError as exc: raise BackupError('Failed to connect to MySQL [%d] %s' % exc.args) try: try: datadir = client.var('datadir') return directory_size(datadir) except MySQL.MySQLError as exc: raise BackupError("Failed to find mysql datadir: [%d] %s" % exc.args) except OSError as exc: raise BackupError( 'Failed to calculate directory size: [%d] %s' % (exc.errno, exc.strerror)) finally: client.close()
def estimate_backup_size(self): """Return estimated backup size""" try: client = MySQL.from_defaults(self.defaults_path) except MySQL.MySQLError as exc: raise BackupError("Failed to connect to MySQL [%d] %s" % exc.args) try: try: datadir = client.var("datadir") return directory_size(datadir) except MySQL.MySQLError as exc: raise BackupError("Failed to find mysql datadir: [%d] %s" % exc.args) except OSError as exc: raise BackupError( "Failed to calculate directory size: [%d] %s" % (exc.errno, exc.strerror) ) finally: client.close()
def estimate_backup_size(self): try: client = MySQL.from_defaults(self.defaults_path) except MySQL.MySQLError, exc: raise BackupError("Failed to connect to MySQL [%d] %s" % exc.args)
def estimate_backup_size(self): try: client = MySQL.from_defaults(self.defaults_path) except MySQL.MySQLError, exc: raise BackupError('Failed to connect to MySQL [%d] %s' % exc.args)