reset mdp
This commit is contained in:
parent
d76ed2febb
commit
d627da4e47
3 changed files with 93 additions and 24 deletions
35
client.py
Executable file
35
client.py
Executable file
|
@ -0,0 +1,35 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import pika
|
||||
import json
|
||||
import config
|
||||
|
||||
rabbit_c = pika.BlockingConnection(config.PARAMS)
|
||||
ch = rabbit_c.channel()
|
||||
ch.queue_declare('CransTicket')
|
||||
|
||||
class Ticket(object):
|
||||
|
||||
data = []
|
||||
|
||||
def add_entry(self, x):
|
||||
self.data.append(x)
|
||||
|
||||
def add_account(self, login, mdp):
|
||||
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'}
|
||||
if machine.has_key('ipsec'):
|
||||
todo['secret'] = machine['ipsec'][0].value
|
||||
todo['type'] = 'wifi'
|
||||
self.add_entry(todo)
|
||||
|
||||
def print(self):
|
||||
ch.basic_publish(exchange='', routing_key='CransTicket', body=json.dumps(self.data))
|
||||
print("Un nouveau ticket est en cours d'impression ...")
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue