'Check if all elements got a good configuration'

def is_correct(self):

    logger.info('Running    pre-flight    check    on    configuration    data...')
    r = self.conf_is_correct
    if (self.read_config_silent == 0):
        logger.info('Checking    global    parameters...')
    if (not self.check_error_on_hard_unmanaged_parameters()):
        r = False
        logger.error('Check    global    parameters    failed')
    for x in ('hosts', 'hostgroups', 'contacts', 'contactgroups', 'notificationways', 'escalations', 'services', 'servicegroups', 'timeperiods', 'commands', 'hostsextinfo', 'servicesextinfo', 'checkmodulations', 'macromodulations'):
        if (self.read_config_silent == 0):
            logger.info('Checking    %s...', x)
        cur = getattr(self, x)
        if (not cur.is_correct()):
            r = False
            logger.error(' DCTB %s    conf    incorrect!!', x)
        if (self.read_config_silent == 0):
            logger.info(' DCTB Checked    %d    %s', len(cur), x)
    if (not self.hosts.no_loop_in_parents('self', 'parents')):
        r = False
        logger.error('Hosts:    detected    loop    in    parents    ;    conf    incorrect')
    for x in ('servicedependencies', 'hostdependencies', 'arbiters', 'schedulers', 'reactionners', 'pollers', 'brokers', 'receivers', 'resultmodulations', 'discoveryrules', 'discoveryruns', 'businessimpactmodulations'):
        try:
            cur = getattr(self, x)
        except AttributeError:
            continue
        if (self.read_config_silent == 0):
            logger.info('Checking    %s...', x)
        if (not cur.is_correct()):
            r = False
            logger.error(' DCTB %s    conf    incorrect!!', x)
        if (self.read_config_silent == 0):
            logger.info(' DCTB Checked    %d    %s', len(cur), x)
    for s in self.schedulers:
        rea = s.realm
        if rea:
            if (len(rea.potential_brokers) == 0):
                logger.error('The    scheduler    %s    got    no    broker    in    its    realm    or    upper', s.get_name())
                self.add_error(('Error:    the    scheduler    %s    got    no    broker    in    its    realm    or    upper' % s.get_name()))
                r = False
    hosts_tag = set()
    services_tag = set()
    pollers_tag = set()
    for h in self.hosts:
        hosts_tag.add(h.poller_tag)
    for s in self.services:
        services_tag.add(s.poller_tag)
    for p in self.pollers:
        for t in p.poller_tags:
            pollers_tag.add(t)
    if (not hosts_tag.issubset(pollers_tag)):
        for tag in hosts_tag.difference(pollers_tag):
            logger.error('Hosts    exist    with    poller_tag    %s    but    no    poller    got    this    tag', tag)
            self.add_error(('Error:    hosts    exist    with    poller_tag    %s    but    no    poller    got    this    tag' % tag))
            r = False
    if (not services_tag.issubset(pollers_tag)):
        for tag in services_tag.difference(pollers_tag):
            logger.error('Services    exist    with    poller_tag    %s    but    no    poller    got    this    tag', tag)
            self.add_error(('Error:    services    exist    with    poller_tag    %s    but    no    poller    got    this    tag' % tag))
            r = False
    for l in [self.services, self.hosts]:
        for e in l:
            if e.got_business_rule:
                e_ro = e.get_realm()
                if (not e_ro):
                    continue
                e_r = e_ro.realm_name
                for elt in e.business_rule.list_all_elements():
                    r_o = elt.get_realm()
                    if (not r_o):
                        continue
                    elt_r = elt.get_realm().realm_name
                    if (not (elt_r == e_r)):
                        logger.error("Business_rule    '%s'    got    hosts    from    another    realm:    %s", e.get_full_name(), elt_r)
                        self.add_error(("Error:    Business_rule    '%s'    got    hosts    from    another    realm:    %s" % (e.get_full_name(), elt_r)))
                        r = False
    if (len([realm for realm in self.realms if (hasattr(realm, 'default') and realm.default)]) > 1):
        err = 'Error    :    More    than    one    realm    are    set    to    the    default    realm'
        logger.error(err)
        self.add_error(err)
        r = False
    self.conf_is_correct = r
