def client_create_backup(self, socket_handler, msg): """Currently hard-coded for testing: need to find out Installation path. Talk to team about right location for backup files they might have to be somewhere outside the installation path as some OSes might not allow the modification of the installation folder e.g. MacOS won't allow for changes if the .app has been signed. and all files created by the app, have to be outside, usually at ~/Library/Application Support/OpenBazaar/backups ?? """ def on_backup_done(backupPath): self.log.info('Backup successfully created at %s', backupPath) self.send_to_client( None, { 'type': 'create_backup_result', 'result': 'success', 'detail': backupPath }) def on_backup_error(error): self.log.info('Backup error: %s', error.strerror) self.send_to_client( None, { 'type': 'create_backup_result', 'result': 'failure', 'detail': error.strerror }) BackupTool.backup(BackupTool.get_installation_path(), BackupTool.get_backup_path(), on_backup_done, on_backup_error)
def client_create_backup(self, socket_handler, msg): """Currently hard-coded for testing: need to find out Installation path. Talk to team about right location for backup files they might have to be somewhere outside the installation path as some OSes might not allow the modification of the installation folder e.g. MacOS won't allow for changes if the .app has been signed. and all files created by the app, have to be outside, usually at ~/Library/Application Support/OpenBazaar/backups ?? """ def on_backup_done(backupPath): self._log.info('Backup successfully created at ' + backupPath) self.send_to_client(None, {'type': 'create_backup_result', 'result': 'success', 'detail': backupPath}) def on_backup_error(error): self._log.info('Backup error:' + str(error.strerror)) self.send_to_client(None, {'type': 'create_backup_result', 'result': 'failure', 'detail': error.strerror}) BackupTool.backup(BackupTool.get_installation_path(), BackupTool.get_backup_path(), on_backup_done, on_backup_error)
def get_backups(self, socket_handler, msg=None): if "127.0.0.1" == socket_handler.request.remote_ip: try: backups = [json.dumps(x, cls=BackupJSONEncoder) for x in Backup.get_backups(BackupTool.get_backup_path())] self.send_to_client(None, {'type': 'on_get_backups_response', 'result': 'success', 'backups': backups }) except: self.send_to_client(None, {'type': 'on_get_backups_response', 'result': 'failure'})