本文整理汇总了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__)
示例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()
示例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()
示例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