host_exists ne marchait pas, le patch pour batb-5 avait coupé mac_prises

This commit is contained in:
Pierre-Elliott Bécue 2015-10-25 22:06:41 +01:00
parent 6f52c57431
commit df4d564ffb
2 changed files with 3 additions and 2 deletions

View file

@ -30,6 +30,7 @@ def host_exists(hostname):
socket.gethostbyname(hostname)
except socket.gaierror:
return False
return True
def liste_chambres_macs(switch, annuaire):
u'''
@ -40,7 +41,7 @@ def liste_chambres_macs(switch, annuaire):
'''
liste_bats = ['a', 'b', 'c', 'g', 'h', 'i', 'j', 'm', 'p']
split = switch.replace('.adm.crans.org', '').split('-')
split = switch.split(".")[0].split('-')
bat, num_switch = split[0][-1], int(split[1][0])
if bat not in liste_bats:
return {}

View file

@ -76,7 +76,7 @@ if __name__ == '__main__':
# parallélise vraiment !
for switch in switches:
output[switch] = threads[switch].output()
curseur = get_curseur(time.time())
requete = "INSERT INTO correspondance (date, chambre, mac) VALUES (%s, %s, %s);"