Commit a93b6ed3 authored by Gabriel Detraz's avatar Gabriel Detraz

Definition des queues principales et auxiliaires dans config.py sur zamok

parent 65fce978
......@@ -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 ...")
......@@ -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é")
......
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