login->host (pour machines)
This commit is contained in:
parent
d627da4e47
commit
0987d2be0a
2 changed files with 8 additions and 5 deletions
|
@ -21,9 +21,11 @@ class Ticket(object):
|
||||||
self.add_entry({'login': login, 'pass': mdp})
|
self.add_entry({'login': login, 'pass': mdp})
|
||||||
|
|
||||||
def add_machine(self, machine):
|
def add_machine(self, machine):
|
||||||
login = machine['host'][0].split('.', 1)[0]
|
todo = {
|
||||||
todo = {'login': login, 'macAddress': machine['macAddress'][0].value,
|
'host': machine['host'][0].split('.', 1)[0],
|
||||||
'type': 'fil'}
|
'macAddress': machine['macAddress'][0].value,
|
||||||
|
'type': 'fil',
|
||||||
|
}
|
||||||
if machine.has_key('ipsec'):
|
if machine.has_key('ipsec'):
|
||||||
todo['secret'] = machine['ipsec'][0].value
|
todo['secret'] = machine['ipsec'][0].value
|
||||||
todo['type'] = 'wifi'
|
todo['type'] = 'wifi'
|
||||||
|
|
5
dump.py
5
dump.py
|
@ -13,7 +13,7 @@ import json
|
||||||
CODING='cp437'
|
CODING='cp437'
|
||||||
DEVICE="/dev/ttyUSB0"
|
DEVICE="/dev/ttyUSB0"
|
||||||
SAMPLE_MACHINE = {
|
SAMPLE_MACHINE = {
|
||||||
'login': 'nouille',
|
'host': 'nouille',
|
||||||
'macAddress': '<automatique>',
|
'macAddress': '<automatique>',
|
||||||
'secret': '**********',
|
'secret': '**********',
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ def print_carac(text, value):
|
||||||
def show_entry(entry):
|
def show_entry(entry):
|
||||||
printer.justify('C')
|
printer.justify('C')
|
||||||
printer.underlineOn()
|
printer.underlineOn()
|
||||||
if 'secret' in entry:
|
if 'host' in entry:
|
||||||
title = u'Détails machine'
|
title = u'Détails machine'
|
||||||
if 'type' in entry:
|
if 'type' in entry:
|
||||||
title += u' ' + entry['type']
|
title += u' ' + entry['type']
|
||||||
|
@ -48,6 +48,7 @@ def show_entry(entry):
|
||||||
printer.underlineOff()
|
printer.underlineOff()
|
||||||
printer.justify('L')
|
printer.justify('L')
|
||||||
|
|
||||||
|
login = entry.get('login', None) or entry['host']
|
||||||
print_carac('Login', entry['login'])
|
print_carac('Login', entry['login'])
|
||||||
if 'macAddress' in entry:
|
if 'macAddress' in entry:
|
||||||
print_carac('Mac', entry['macAddress'])
|
print_carac('Mac', entry['macAddress'])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue