def _get_equipment_access(self, protocol): try: return EquipamentoAcesso.search( None, self.equipment, protocol).uniqueResult() except Exception: log.error('Access type %s not found for equipment %s.' % ('http', self.equipment.nome)) raise exceptions.InvalidEquipmentAccessException()
def _get_equipment_access(self): try: self.equipment_access = EquipamentoAcesso.search( None, self.equipment, 'https').uniqueResult() except Exception, e: log.error('Access type %s not found for equipment %s.' % ('https', self.equipment.nome)) raise exceptions.InvalidEquipmentAccessException()
def _get_host(self): protocol = 'http' self.equipment_access = self._get_equipment_access(protocol) if not isinstance(self.equipment_access, EquipamentoAcesso): log.error('No fqdn could be found for equipment %s .' % (self.equipment.nome)) raise exceptions.InvalidEquipmentAccessException() host = self.equipment_access.fqdn.strip() if host.find('://') < 0: host = protocol + '://' + host + ':8008' return host
def _get_host(self): if not hasattr(self, 'host'): if not hasattr( self, 'equipment_access') or self.equipment_access == None: log.error('No fqdn could be found for equipment %s .' % (self.equipment.nome)) raise exceptions.InvalidEquipmentAccessException() self.host = self.equipment_access.fqdn.strip() if self.host.find('://') < 0: self.host = self.protocol + '://' + self.host return self.host
def _get_host(self): if not hasattr(self, 'host') or self.host is None: if not isinstance(self.equipment_access, EquipamentoAcesso): log.error( 'No fqdn could be found for equipment {equipment}.'.format( equipment=self.equipment.nome)) raise exceptions.InvalidEquipmentAccessException() self.host = self.equipment_access.fqdn.strip() if self.host.find('://') < 0: self.host = self.protocol + '://' + self.host return self.host
def _get_equipment_access(self): """ Tries to get the equipment access """ try: access = None try: access = EquipamentoAcesso.search(None, self.equipment, 'https').uniqueResult() except ObjectDoesNotExist: access = EquipamentoAcesso.search(None, self.equipment, 'http').uniqueResult() return access except Exception: log.error('Access type %s not found for equipment %s.' % ('https', self.equipment.nome)) raise exceptions.InvalidEquipmentAccessException()