コード例 #1
0
 def doInitInterfaces(self, *args, **kwargs):
     if _Debug:
         lg.out(_DebugLevel, 'initializer.doInitInterfaces')
     # if settings.enableFTPServer():
     #     try:
     #         from interface import ftp_server
     #         ftp_server.init()
     #     except:
     #         lg.exc()
     if settings.enableAPIAuthSecret():
         current_secret = local_fs.ReadTextFile(settings.APISecretFile())
         if not current_secret:
             new_secret = cipher.generate_secret_text(10)
             local_fs.WriteTextFile(settings.APISecretFile(), new_secret)
             lg.info('generated new API auth secret text and stored in %r' % settings.APISecretFile())
     if settings.enableRESTHTTPServer():
         try:
             from interface import api_rest_http_server
             api_rest_http_server.init(port=settings.getRESTHTTPServerPort())
         except:
             lg.exc()
     if settings.enableWebSocketServer():
         try:
             from interface import api_web_socket
             api_web_socket.init(port=settings.getWebSocketServerPort())
         except:
             lg.exc()
     reactor.callLater(0, self.automat, 'init-interfaces-done')  # @UndefinedVariable
コード例 #2
0
ファイル: initializer.py プロジェクト: codingcosmonaut/devel
 def doInitInterfaces(self, *args, **kwargs):
     if bpio.Android():
         lg.close_intercepted_log_file()
         lg.open_intercepted_log_file(
             os.path.join(settings.LogsDir(), 'android.log'))
     if _Debug:
         lg.out(_DebugLevel, 'initializer.doInitInterfaces')
     if settings.enableFTPServer():
         try:
             from interface import ftp_server
             ftp_server.init()
         except:
             lg.exc()
     if settings.enableJsonRPCServer():
         try:
             from interface import api_jsonrpc_server
             api_jsonrpc_server.init()
         except:
             lg.exc()
     if settings.enableRESTHTTPServer():
         try:
             from interface import api_rest_http_server
             api_rest_http_server.init(
                 port=settings.getRESTHTTPServerPort())
         except:
             lg.exc()
     if settings.enableWebSocketServer():
         try:
             from interface import api_web_socket
             api_web_socket.init(port=settings.getWebSocketServerPort())
         except:
             lg.exc()
     reactor.callLater(0, self.automat,
                       'init-interfaces-done')  # @UndefinedVariable
コード例 #3
0
 def doInitInterfaces(self, arg):
     lg.out(2, 'initializer.doInitInterfaces')
     if settings.enableFTPServer():
         from interface import ftp_server
         ftp_server.init()
     if settings.enableJsonRPCServer():
         from interface import api_jsonrpc_server
         api_jsonrpc_server.init()
     if settings.enableRESTHTTPServer():
         from interface import api_rest_http_server
         api_rest_http_server.init(port=settings.getRESTHTTPServerPort())
     reactor.callLater(0, self.automat, 'init-interfaces-done')