ra2.py : on-off sur la prise quand bl ra
This commit is contained in:
parent
87e363e4bf
commit
05f9c4580d
1 changed files with 11 additions and 0 deletions
|
@ -13,12 +13,14 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import subprocess
|
import subprocess
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
# On importe les scripts Crans
|
# On importe les scripts Crans
|
||||||
import lc_ldap.shortcuts
|
import lc_ldap.shortcuts
|
||||||
from cranslib import clogger
|
from cranslib import clogger
|
||||||
from gestion import mail
|
from gestion import mail
|
||||||
from utils.sendmail import actually_sendmail
|
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:
|
# On règle le nombre de RA admissibles par jour par machine:
|
||||||
TOL = 3
|
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.blacklist('ipv6_ra', u'auto ra.py : router advertisement', debut='now', fin='-')
|
||||||
machine.save()
|
machine.save()
|
||||||
send_mail(machine)
|
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 :
|
# On envoie une notification à disconnect et à la personne :
|
||||||
def send_mail(machine):
|
def send_mail(machine):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue