示例#1
0
    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)
示例#2
0
文件: ws.py 项目: anduck/OpenBazaar
    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)
示例#3
0
文件: ws.py 项目: kewllife/OpenBazaar
    def client_create_backup(self, socket_handler, msg):
        """Currently hardcoded 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 sucessfully 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})

        # TODO: Make backup path configurable on server settings before run.sh
        OB_PATH = os.path.realpath(os.path.abspath(__file__))[:os.path.realpath(os.path.abspath(__file__)).find('/node')]
        BACKUP_PATH = OB_PATH + os.sep + "html" + os.sep + 'backups'
        BackupTool.backup(OB_PATH,
                          BACKUP_PATH,
                          on_backup_done,
                          on_backup_error)
示例#4
0
    def client_create_backup(self, socket_handler, msg):
        """Currently hardcoded 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 sucessfully 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
                })

        #TODO: Make backup path configurable on server settings before run.sh
        OB_PATH = os.path.realpath(
            os.path.abspath(__file__)
        )[:os.path.realpath(os.path.abspath(__file__)).find('/node')]
        BACKUP_PATH = OB_PATH + os.sep + "html" + os.sep + 'backups'
        BackupTool.backup(OB_PATH, BACKUP_PATH, on_backup_done,
                          on_backup_error)
示例#5
0
文件: ws.py 项目: anduck/OpenBazaar
 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'})
示例#6
0
 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'})