From a93b6ed3aae7f060e630aa049d384bf210c69f27 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Tue, 25 Aug 2015 00:29:21 +0200 Subject: [PATCH] Definition des queues principales et auxiliaires dans config.py sur zamok --- client.py | 12 ++++++++---- dump_creds.py | 4 +++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/client.py b/client.py index d6aa03f..767aa8e 100644 --- a/client.py +++ b/client.py @@ -10,6 +10,8 @@ import datetime import string from lc_ldap import crans_utils +import config + CREDS = pika.credentials.PlainCredentials('oie', secrets.get('rabbitmq_oie'), True) import sys if '--debug' in sys.argv[1:]: @@ -23,8 +25,10 @@ ch = rabbit_c.channel() if '--debug' in sys.argv[1:]: QUEUE_NAME = 'CransTicketDebug' print("Debug") +elif '--aux' in sys.argv[1:]: + QUEUE_NAME = config.AUXQUEUE else: - QUEUE_NAME = 'CransTicket' + QUEUE_NAME = config.MAINQUEUE ch.queue_declare(QUEUE_NAME) def gen_password(): @@ -35,9 +39,9 @@ def gen_password(): return ''.join([random.choice(chars) for _ in xrange(length)]) class Ticket(object): - + data = [] - + def add_entry(self, x): self.data.append(x) @@ -103,4 +107,4 @@ class Ticket(object): ch.basic_publish(exchange='', routing_key=QUEUE_NAME, body=json.dumps(self.data)) print("Un nouveau ticket est en cours d'impression ...") - + diff --git a/dump_creds.py b/dump_creds.py index 26b8a29..8a5529a 100755 --- a/dump_creds.py +++ b/dump_creds.py @@ -26,6 +26,8 @@ for arg in sys.argv[1:]: conf_reset_password = True elif arg == '--debug': pass + elif arg == '--aux': + pass elif arg.startswith('--'): print("Unknown arg") exit(12) @@ -47,7 +49,7 @@ else: item = res[0] if 'uid' not in item: conf_reset_password = False - + item.display() if conf_reset_password: print("Le mot de passe (compte Crans) sera également réinitialisé")