dump_creds: ajoute mode debug
This commit is contained in:
parent
6b74765a55
commit
efc1367292
2 changed files with 13 additions and 2 deletions
13
client.py
13
client.py
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue