From 962e284d11a06317e72e5df466f2238a0119ca5a Mon Sep 17 00:00:00 2001 From: glondu Date: Thu, 2 Mar 2006 17:11:25 +0100 Subject: [PATCH] Classe BorneWifi. darcs-hash:20060302161125-68412-22a95570d131e655f5570a08a92a3135604ba32e.gz --- gestion/gen_confs/autostatus.py | 4 ++-- gestion/gen_confs/firewall.py | 5 ++--- gestion/gen_confs/supervison.py | 4 ++-- gestion/gen_confs/switchs.py | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/gestion/gen_confs/autostatus.py b/gestion/gen_confs/autostatus.py index 0d5470ac..c304c7eb 100755 --- a/gestion/gen_confs/autostatus.py +++ b/gestion/gen_confs/autostatus.py @@ -10,7 +10,7 @@ Utilis import sys, os, commands sys.path.append('/usr/scripts/gestion') -from ldap_crans import crans +from ldap_crans import crans, BorneWifi from gen_confs import gen_config # définition de la classe @@ -162,7 +162,7 @@ class autostatus(gen_config) : continue # les bornes - if m.canal() : + if isinstance(m, BorneWifi): # C'est une borne info = filter(lambda x: not x.startswith("<"), m.info()) if info: diff --git a/gestion/gen_confs/firewall.py b/gestion/gen_confs/firewall.py index 17fa6e19..d6850dc1 100755 --- a/gestion/gen_confs/firewall.py +++ b/gestion/gen_confs/firewall.py @@ -28,7 +28,7 @@ sys.path.append('/usr/scripts/gestion') import syslog import pwd from lock import * -from ldap_crans import crans_ldap, ann_scol, machine, crans, invite, hostname +from ldap_crans import crans_ldap, ann_scol, Machine, crans, invite, hostname from affich_tools import * from commands import getstatusoutput from iptools import AddrInNet @@ -675,8 +675,7 @@ class firewall_komaz(firewall_crans) : self.anim.cycle() sanctions = entite.blacklist_actif() if 'upload' in sanctions or 'warez' in sanctions or 'p2p' in sanctions or 'autodisc' in sanctions : - from ldap_crans import machine - if entite.__class__ == machine: + if isinstance(entite, Machine): blacklist+=[entite] else: blacklist+=entite.machines() diff --git a/gestion/gen_confs/supervison.py b/gestion/gen_confs/supervison.py index e41b0deb..b2ef1cb0 100755 --- a/gestion/gen_confs/supervison.py +++ b/gestion/gen_confs/supervison.py @@ -5,7 +5,7 @@ import sys, smtplib, commands sys.path.append('/usr/scripts/gestion') -from ldap_crans import smtpserv, crans, crans_ldap, machine, adherent, club +from ldap_crans import smtpserv, crans, crans_ldap, Machine, adherent, club from whos import machine_details, adher_details, club_details from gen_confs import gen_config from affich_tools import cprint, OK, anim @@ -45,7 +45,7 @@ Subject: %(Subject)s for res in results : if res.dn in vus : continue vus.append(res.dn) - if res.__class__ == machine : + if isinstance(res, Machine): details.append(machine_details(res)) elif res.__class__ == adherent : details.append(adher_details(res)) diff --git a/gestion/gen_confs/switchs.py b/gestion/gen_confs/switchs.py index de750056..54de0b90 100755 --- a/gestion/gen_confs/switchs.py +++ b/gestion/gen_confs/switchs.py @@ -18,7 +18,7 @@ import string, sys, os, commands, smtplib sys.path.append('/usr/scripts/gestion') from hptools import hpswitch, sw_chbre -from ldap_crans import crans_ldap +from ldap_crans import crans_ldap, BorneWifi from annuaires import chbre_prises, uplink_prises, reverse, bat_manuels, all_switchs from random import shuffle from gen_confs import * @@ -307,7 +307,7 @@ exit adm=0 autres=0 for m in crans_prises["%s%s" % (bat.upper(), annu_prise)] : - if m.canal() : wifi+=1 + if isinstance(m, BorneWifi): wifi += 1 elif m.Nom().find('.adm.crans.org')!=-1 : adm+=1 else : autres+=1 if autres==0 and adm==0 :