Exemplo n.º 1
0
    def after_insert(self, mapper, connection, instance):
        from vigilo.models.tables.state import State
        from vigilo.models.tables.statename import StateName
        from vigilo.models.tables.service import Service

        # Pour un service (HLS ou LLS) : on initialise à UNKNOWN.
        if isinstance(instance, Service):
            state = StateName.statename_to_value(u"UNKNOWN")
        # Pour un hôte : on initialise à UP.
        else:
            state = StateName.statename_to_value(u"UP")

        s = State(idsupitem=instance.idsupitem, state=state, message=u"")
        DBSession.merge(s)
        return EXT_CONTINUE
Exemplo n.º 2
0
 def _set_current_state(self, value):
     """Modifie la valeur textuelle de l'état courant."""
     if self._current_state == value:
         return # rien n'a changé, inutile de gérer le peak state
     if self._peak_state is None:
         self._peak_state = value
         self._initial_state = value
     else:
         # Si l'ancien état est moins grave que le nouveau,
         # on se met à jour.
         if StateName.compare_from_values(self._peak_state, value) < 0:
             self._peak_state = value
     self._current_state = value