Example #1
0
 def run(self):
     time.sleep(2)
     proxy = xmlrpc.client.ServerProxy(dissomniagLive.getIdentity().getServerUri())
     for i in range(1,5):
         if proxy.update(dissomniagLive.getIdentity().getXMLStatusAnswer()) == True:
             dissomniagLive.getIdentity().serverReachable = True
             log.info("Pushed local Infos to Server.")
             break
     if dissomniagLive.getIdentity().serverReachable == False:
         log.error("Could not reach Central Server!")
Example #2
0
 def addApp(self, name, serverUser, serverIpOrHost):
     with self.lock:
         if not self._isIn(name):
             app = dissomniagLive.app.App(
                 name, serverUser, serverIpOrHost,
                 dissomniagLive.getIdentity().getServerUri(),
                 dissomniagLive.getIdentity().commonName,
                 dissomniagLive.getIdentity().getUUID(),
                 self.appDeleteListener)
             app.start()
             self.apps[name] = app
             return app
 def addApp(self, name, serverUser, serverIpOrHost):
     with self.lock:
         if not self._isIn(name):
             app = dissomniagLive.app.App(
                 name,
                 serverUser,
                 serverIpOrHost,
                 dissomniagLive.getIdentity().getServerUri(),
                 dissomniagLive.getIdentity().commonName,
                 dissomniagLive.getIdentity().getUUID(),
                 self.appDeleteListener,
             )
             app.start()
             self.apps[name] = app
             return app
Example #4
0
 def disableStrictServerKeyChecking(hostOrIp):
     with dissomniagLive.getIdentity().sshConfigLock:
         sshFileName = "/etc/ssh/ssh_config"
         
         if os.path.isfile(sshFileName):
             lines = None
             pattern = ("^Host %s$" % hostOrIp)
             prog = re.compile(pattern)
             with open(sshFileName, 'r') as f:
                 lines = f.readlines()
             foundHosts = []
             for line in lines:
                 if prog.match(line):
                     return True
             
         
         if not os.path.isfile(sshFileName):
             try:
                 with open(sshFileName, mode='w') as f:
                     f.write("")
                 os.chmod(sshFileName, 0o644)
             except OSError:
                 pass
         
         with open(sshFileName, 'a') as f:
             f.write("Host %s\n" % hostOrIp)
             f.write("\tStrictHostKeyChecking no\n\n")
Example #5
0
 def _sendInfo(self):
     with self.threadingLock: # Da wir auf namespace Daten lesend bzw. schreibend zugreifen
         try:
             proxy = xmlrpc.client.ServerProxy(dissomniagLive.getIdentity().getServerUri())
             self.log.info(self._getInfoXmlMsg())
             proxy.updateAppInfo(self._getInfoXmlMsg())
         except Exception as e:
             self.log.error("Could not send Info to central system. %s" % str(e))
         else:
             self._cleanLog()
Example #6
0
def update(infoXml):
    xml = ElementTree.XML(infoXml)
    dissomniagLive.getIdentity().fetchConfig(xml, update = True)
    
    return dissomniagLive.getIdentity().getXMLStatusAnswer()
Example #7
0
def update(infoXml):
    xml = ElementTree.XML(infoXml)
    dissomniagLive.getIdentity().fetchConfig(xml, update=True)

    return dissomniagLive.getIdentity().getXMLStatusAnswer()