def linkify_servicegroups_services(self, hosts, services):
        """
        We just search for each host the id of the host
        and replace the name by the id
        TODO: very slow for high services, so search with host list,
        not service one

        :param hosts: hosts object
        :type hosts: alignak.objects.host.Hosts
        :param services: services object
        :type services: alignak.objects.service.Services
        :return: None
        """
        for servicegroup in self:
            mbrs = servicegroup.get_services()
            # The new member list, in id
            new_mbrs = []
            seek = 0
            host_name = ''
            if len(mbrs) == 1 and mbrs[0] != '':
                servicegroup.add_unknown_members('%s' % mbrs[0])

            for mbr in mbrs:
                if not mbr:
                    continue
                if seek % 2 == 0:
                    host_name = mbr.strip()
                else:
                    service_desc = mbr.strip()
                    find = services.find_srv_by_name_and_hostname(host_name, service_desc)
                    if find is not None:
                        new_mbrs.append(find.uuid)
                    else:
                        host = hosts.find_by_name(host_name)
                        if not (host and host.is_excluded_for_sdesc(service_desc)):
                            servicegroup.add_unknown_members('%s,%s' % (host_name, service_desc))
                        elif host:
                            self.add_warning('servicegroup %r : %s is excluded from the '
                                             'services of the host %s'
                                             % (servicegroup, service_desc, host_name))
                seek += 1

            # Make members uniq
            new_mbrs = list(set(new_mbrs))

            # We find the id, we replace the names
            servicegroup.replace_members(new_mbrs)
            for srv_id in servicegroup.members:
                serv = services[srv_id]
                serv.servicegroups.append(servicegroup.uuid)
                # and make this uniq
                serv.servicegroups = list(set(serv.servicegroups))
def linkify_servicegroups_services ( self , hosts , services ) : for servicegroup in self : mbrs = servicegroup . get_services ( ) new_mbrs = [ ] seek = 0 host_name = '' if len ( mbrs ) == 1 and mbrs [ 0 ] != '' : servicegroup . add_unknown_members ( '%s' % mbrs [ 0 ] ) for mbr in mbrs : if not mbr : continue if seek % 2 == 0 : host_name = mbr . strip ( ) else : service_desc = mbr . strip ( ) find = services . find_srv_by_name_and_hostname ( host_name , service_desc ) if find is not None : new_mbrs . append ( find . uuid ) else : host = hosts . find_by_name ( host_name ) if not ( host and host . is_excluded_for_sdesc ( service_desc ) ) : servicegroup . add_unknown_members ( '%s,%s' % ( host_name , service_desc ) ) elif host : self . add_warning ( 'servicegroup %r : %s is excluded from the ' 'services of the host %s' % ( servicegroup , service_desc , host_name ) ) seek += 1 new_mbrs = list ( set ( new_mbrs ) ) servicegroup . replace_members ( new_mbrs ) for srv_id in servicegroup . members : serv = services [ srv_id ] serv . servicegroups . append ( servicegroup . uuid ) serv . servicegroups = list ( set ( serv . servicegroups ) )
We just search for each host the id of the host
        and replace the name by the id
        TODO: very slow for high services, so search with host list,
        not service one

        :param hosts: hosts object
        :type hosts: alignak.objects.host.Hosts
        :param services: services object
        :type services: alignak.objects.service.Services
        :return: None