当前位置: 首页>>代码示例>>Python>>正文


Python Server.iter_servers方法代码示例

本文整理汇总了Python中server.Server.iter_servers方法的典型用法代码示例。如果您正苦于以下问题:Python Server.iter_servers方法的具体用法?Python Server.iter_servers怎么用?Python Server.iter_servers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在server.Server的用法示例。


在下文中一共展示了Server.iter_servers方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _upgrade_data

# 需要导入模块: from server import Server [as 别名]
# 或者: from server.Server import iter_servers [as 别名]
    def _upgrade_data(self):
        version = self._get_version()
        cur_version = self._get_data_version()

        if cur_version and cur_version < self._get_version_int('0.10.5'):
            logger.info('Upgrading data to v0.10.5...')
            from server import Server
            for server in Server.iter_servers():
                server._upgrade_0_10_5()

            from organization import Organization
            for org in Organization.iter_orgs():
                org._upgrade_0_10_5()

        if cur_version and cur_version < self._get_version_int('0.10.6'):
            logger.info('Upgrading data to v0.10.6...')
            if self.password:
                from cache import persist_db
                logger.info('Upgrading config to v0.10.6...')
                salt = base64.b64encode(
                    '2511cebca93d028393735637bbc8029207731fcf')
                password = base64.b64encode(self.password.decode('hex'))
                persist_db.dict_set('auth', 'password',
                    '0$%s$%s' % (salt, password))
                self.password = None
                self.commit()

            from server import Server
            for server in Server.iter_servers():
                server._upgrade_0_10_6()

        if cur_version and cur_version < self._get_version_int('0.10.9'):
            logger.info('Upgrading data to v0.10.9...')
            from server import Server
            for server in Server.iter_servers():
                server._upgrade_0_10_9()

            from organization import Organization
            for org in Organization.iter_orgs():
                for user in org.iter_users():
                    user._upgrade_0_10_9()
                org.sort_users_cache()

        if cur_version != version:
            from pritunl import __version__
            version_path = os.path.join(self.data_path, VERSION_NAME)
            with open(version_path, 'w') as version_file:
                version_file.write('%s\n' % __version__)
开发者ID:WrongChao,项目名称:pritunl,代码行数:50,代码来源:app_server.py

示例2: _fill_cache

# 需要导入模块: from server import Server [as 别名]
# 或者: from server.Server import iter_servers [as 别名]
    def _fill_cache(self):
        logger.info('Preloading cache...')
        from organization import Organization
        for org in Organization.iter_orgs():
            org._cache_users()

        from server import Server
        for server in Server.iter_servers():
            server.load()
开发者ID:WrongChao,项目名称:pritunl,代码行数:11,代码来源:app_server.py

示例3: _run_wsgi

# 需要导入模块: from server import Server [as 别名]
# 或者: from server.Server import iter_servers [as 别名]
    def _run_wsgi(self):
        if self.ssl:
            self._setup_server_cert()
        from log_entry import LogEntry
        logger.info('Starting server...')

        if self.auto_start_servers:
            from pritunl.server import Server
            for server in Server.iter_servers():
                if server.org_count:
                    try:
                        server.start()
                    except:
                        logger.exception('Failed to auto start server. %r' % {
                            'server_id': server.id,
                        })

        server = cherrypy.wsgiserver.CherryPyWSGIServer(
            (self.bind_addr, self.port), self.app,
            request_queue_size=SERVER_REQUEST_QUEUE_SIZE,
            server_name=cherrypy.wsgiserver.CherryPyWSGIServer.version)
        if self.ssl:
            server.ssl_adapter = \
                cherrypy.wsgiserver.ssl_builtin.BuiltinSSLAdapter(
                    self._server_cert_path, self._server_key_path)
        try:
            server.start()
        except (KeyboardInterrupt, SystemExit):
            pass
        except:
            logger.exception('Server error occurred')
            raise
        finally:
            signal.signal(signal.SIGINT, signal.SIG_IGN)
            logger.info('Stopping server...')
            LogEntry(message='Web server stopped.')
            self.interrupt = True
            server.stop()
开发者ID:WrongChao,项目名称:pritunl,代码行数:40,代码来源:app_server.py

示例4: iter_servers

# 需要导入模块: from server import Server [as 别名]
# 或者: from server.Server import iter_servers [as 别名]
 def iter_servers(self):
     from server import Server
     for server in Server.iter_servers():
         if self.id in server.organizations:
             yield server
开发者ID:WrongChao,项目名称:pritunl,代码行数:7,代码来源:organization.py


注:本文中的server.Server.iter_servers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。