Commit efc13672 authored by Daniel STAN's avatar Daniel STAN

dump_creds: ajoute mode debug

parent 6b74765a
......@@ -11,12 +11,21 @@ import string
from lc_ldap import crans_utils
CREDS = pika.credentials.PlainCredentials('oie', secrets.get('rabbitmq_oie'), True)
import sys
if '--debug' in sys.argv[1:]:
CREDS = pika.credentials.PlainCredentials('rasputin', secrets.get('rabbitmq_rasputin'), True)
PARAMS = pika.ConnectionParameters(host='rabbitmq.crans.org',
port=5671, credentials=CREDS, ssl=True)
rabbit_c = pika.BlockingConnection(PARAMS)
ch = rabbit_c.channel()
ch.queue_declare('CransTicket')
if '--debug' in sys.argv[1:]:
QUEUE_NAME = 'CransTicketDebug'
print("Debug")
else:
QUEUE_NAME = 'CransTicket'
ch.queue_declare(QUEUE_NAME)
def gen_password():
"""Génère un mot de passe aléatoire"""
......@@ -62,7 +71,7 @@ class Ticket(object):
if not self.data:
print("Nothing to print !")
return
ch.basic_publish(exchange='', routing_key='CransTicket',
ch.basic_publish(exchange='', routing_key=QUEUE_NAME,
body=json.dumps(self.data))
print("Un nouveau ticket est en cours d'impression ...")
......@@ -23,6 +23,8 @@ for arg in sys.argv[1:]:
conf_wifi_only = False
elif arg == '--pass':
conf_reset_password = True
elif arg == '--debug':
pass
elif arg.startswith('--'):
print("Unknown arg")
exit(12)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment