コード例 #1
0
 def getMirror(self, machine):
     if self.initialized_failed:
         return []
     machine = self.convertMachineIntoH(machine)
     uuid = machine['uuid']
     try:
         entity_uuid = ComputerLocationManager().getMachinesLocations(
             [uuid])[uuid]['uuid']
         parent_entities = [
             entity_uuid
         ] + ComputerLocationManager().getLocationParentPath(entity_uuid)
         url = ''
         entity_uuid = ''
         db = ImagingDatabase()
         for _uuid in parent_entities:
             urlsearch = db.getEntityUrl(_uuid)
             if urlsearch is not None:
                 entity_uuid = _uuid
                 url = urlsearch
                 break
         Entity_Name = ComputerLocationManager().getLocationName(
             entity_uuid)
         machine['Entity_Name'] = Entity_Name
         serverinfo = db.getImagingServerInfo(entity_uuid)
         machine['entity_uuid'] = entity_uuid
         machine['server'] = urlparse(url).hostname
         machine['servernane'] = serverinfo.name
     except:
         logging.getLogger().error(
             "Cannot get Entity for this machine UUID (%s)" % uuid)
     d = self.callRemote("getMirror", machine)
     d.addErrback(self.onError, "MirrorApi:getMirror", machine)
     return d
コード例 #2
0
ファイル: mirror_api.py プロジェクト: pulse-project/pulse
    def getApiPackage(self, machine):
        if self.initialized_failed:
            return []
        machine = self.convertMachineIntoH(machine)
        uuid = machine["uuid"]
        try:
            entity_uuid = ComputerLocationManager().getMachinesLocations([uuid])[uuid]["uuid"]
            parent_entities = [entity_uuid] + ComputerLocationManager().getLocationParentPath(entity_uuid)
            url = ""
            entity_uuid = ""
            db = ImagingDatabase()
            for _uuid in parent_entities:
                urlsearch = db.getEntityUrl(_uuid)
                if urlsearch is not None:
                    entity_uuid = _uuid
                    url = urlsearch
                    break
            Entity_Name = ComputerLocationManager().getLocationName(entity_uuid)
            machine["Entity_Name"] = Entity_Name
            serverinfo = db.getImagingServerInfo(entity_uuid)
            machine["entity_uuid"] = entity_uuid
            machine["server"] = urlparse(url).hostname
            machine["servernane"] = serverinfo.name
        except:
            logging.getLogger().error("Cannot get Entity for this machine UUID (%s)" % uuid)

        d = self.callRemote("getApiPackage", machine)
        d.addErrback(self.onError, "MirrorApi:getApiPackage", machine)
        return d