comparison libervia/server/server.py @ 1126:7cd89277a129

server: fixed missing backend detection
author Goffi <goffi@goffi.org>
date Fri, 31 Aug 2018 18:08:06 +0200
parents 28e3eb3bb217
children 9234f29053b0
comparison
equal deleted inserted replaced
1125:56ace2d45783 1126:7cd89277a129
1633 self.sessions = {} # key = session value = user 1633 self.sessions = {} # key = session value = user
1634 self.prof_connected = set() # Profiles connected 1634 self.prof_connected = set() # Profiles connected
1635 self.ns_map = {} # map of short name to namespaces 1635 self.ns_map = {} # map of short name to namespaces
1636 1636
1637 ## bridge ## 1637 ## bridge ##
1638 try: 1638 self.bridge = Bridge()
1639 self.bridge = Bridge()
1640 except BridgeExceptionNoService:
1641 print(u"Can't connect to SàT backend, are you sure it's launched ?")
1642 sys.exit(1)
1643 self.bridge.bridgeConnect(callback=self._bridgeCb, errback=self._bridgeEb) 1639 self.bridge.bridgeConnect(callback=self._bridgeCb, errback=self._bridgeEb)
1644 1640
1645 def _namespacesGetCb(self, ns_map): 1641 def _namespacesGetCb(self, ns_map):
1646 self.ns_map = ns_map 1642 self.ns_map = ns_map
1647 1643
1786 lambda failure: self.initialised.errback(Exception(failure)), 1782 lambda failure: self.initialised.errback(Exception(failure)),
1787 ) 1783 )
1788 self.initialised.addCallback(self.backendReady) 1784 self.initialised.addCallback(self.backendReady)
1789 self.initialised.addErrback(self.initEb) 1785 self.initialised.addErrback(self.initEb)
1790 1786
1791 def _bridgeEb(self, failure): 1787 def _bridgeEb(self, failure_):
1792 log.error(u"Can't connect to bridge: {}".format(failure)) 1788 if isinstance(failure_, BridgeExceptionNoService):
1789 print(u"Can't connect to SàT backend, are you sure it's launched ?")
1790 else:
1791 log.error(u"Can't connect to bridge: {}".format(failure))
1792 sys.exit(1)
1793 1793
1794 @property 1794 @property
1795 def version(self): 1795 def version(self):
1796 """Return the short version of Libervia""" 1796 """Return the short version of Libervia"""
1797 return C.APP_VERSION 1797 return C.APP_VERSION