Exemple #1
0
    def explode(self, escalations):
        """Create instance of Escalation for each HostEscalation object

        :param escalations: list of escalation, used to add new ones
        :type escalations: alignak.objects.escalation.Escalations
        :return: None
        """
        # Now we explode all escalations (host_name, hostgroup_name) to escalations
        for escalation in self:
            properties = escalation.__class__.properties
            name = getattr(escalation, 'host_name', getattr(escalation, 'hostgroup_name', ''))
            creation_dict = {
                'escalation_name':
                    'Generated-HostEscalation-%s-%s' % (name, escalation.uuid)
            }
            for prop in properties:
                if hasattr(escalation, prop):
                    creation_dict[prop] = getattr(escalation, prop)

            escalations.add_escalation(Escalation(creation_dict))
Exemple #2
0
    def explode(self, escalations):
        """Create instance of Escalation for each ServiceEscalation object

        :param escalations: list of escalation, used to add new ones
        :type escalations: alignak.objects.escalation.Escalations
        :return: None
        """
        # Now we explode all escalations (host_name, service_description) to escalations
        for svescal in self:
            properties = svescal.__class__.properties

            creation_dict = {
                'escalation_name':
                'Generated-Serviceescalation-%d' % svescal._id
            }
            for prop in properties:
                if hasattr(svescal, prop):
                    creation_dict[prop] = getattr(svescal, prop)
            # print "Creation an escalation with:", creation_dict
            escalation = Escalation(creation_dict)
            escalations.add_escalation(escalation)
Exemple #3
0
 def setUp(self):
     from alignak.objects.escalation import Escalation
     self.item = Escalation(parsing=True)
Exemple #4
0
 def setUp(self):
     super(TestEscalation, self).setUp()
     from alignak.objects.escalation import Escalation
     self.item = Escalation(parsing=True)