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 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
|
||||
|
@ -66,6 +68,15 @@ def ra_blacklist(Mac_ra):
|
|||
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):
|
||||
adh = machine.proprio()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue