From 05f9c4580df846134ce3bde7829bad6604688042 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Wed, 25 Feb 2015 20:41:41 +0100 Subject: [PATCH] ra2.py : on-off sur la prise quand bl ra --- surveillance/ra2.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/surveillance/ra2.py b/surveillance/ra2.py index 6627315a..34ae5bd2 100755 --- a/surveillance/ra2.py +++ b/surveillance/ra2.py @@ -13,12 +13,14 @@ import os import sys import time import subprocess +from time import sleep # On importe les scripts Crans import lc_ldap.shortcuts from cranslib import clogger from gestion import mail from utils.sendmail import actually_sendmail +from utils.chambre_on_off import chambre_on_off # On règle le nombre de RA admissibles par jour par machine: TOL = 3 @@ -65,6 +67,15 @@ def ra_blacklist(Mac_ra): machine.blacklist('ipv6_ra', u'auto ra.py : router advertisement', debut='now', fin='-') machine.save() send_mail(machine) + + # Si machine filaire et si adh sur le campus, on-off sur la prise + if machine.ldap_name == 'machineFixe': + adh = machine.proprio() + chambre = unicode(adh['chbre'][0]) + if chambre != "EXT": + chambre_on_off(chambre,"off") + time.sleep(5) + chambre_on_off(chambre,"on") # On envoie une notification à disconnect et à la personne : def send_mail(machine):