From 0987d2be0a37fcafff2c5c23c3a4134155a1d322 Mon Sep 17 00:00:00 2001 From: Daniel STAN Date: Sun, 31 Aug 2014 16:54:46 +0200 Subject: [PATCH] login->host (pour machines) --- client.py | 8 +++++--- dump.py | 5 +++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/client.py b/client.py index 570afcf..d050a7b 100755 --- a/client.py +++ b/client.py @@ -21,9 +21,11 @@ class Ticket(object): self.add_entry({'login': login, 'pass': mdp}) def add_machine(self, machine): - login = machine['host'][0].split('.', 1)[0] - todo = {'login': login, 'macAddress': machine['macAddress'][0].value, - 'type': 'fil'} + todo = { + 'host': machine['host'][0].split('.', 1)[0], + 'macAddress': machine['macAddress'][0].value, + 'type': 'fil', + } if machine.has_key('ipsec'): todo['secret'] = machine['ipsec'][0].value todo['type'] = 'wifi' diff --git a/dump.py b/dump.py index c3719e0..3e07e2c 100755 --- a/dump.py +++ b/dump.py @@ -13,7 +13,7 @@ import json CODING='cp437' DEVICE="/dev/ttyUSB0" SAMPLE_MACHINE = { - 'login': 'nouille', + 'host': 'nouille', 'macAddress': '', 'secret': '**********', } @@ -38,7 +38,7 @@ def print_carac(text, value): def show_entry(entry): printer.justify('C') printer.underlineOn() - if 'secret' in entry: + if 'host' in entry: title = u'Détails machine' if 'type' in entry: title += u' ' + entry['type'] @@ -48,6 +48,7 @@ def show_entry(entry): printer.underlineOff() printer.justify('L') + login = entry.get('login', None) or entry['host'] print_carac('Login', entry['login']) if 'macAddress' in entry: print_carac('Mac', entry['macAddress'])