Definition des queues principales et auxiliaires dans config.py sur zamok
This commit is contained in:
parent
65fce978f9
commit
a93b6ed3aa
2 changed files with 11 additions and 5 deletions
12
client.py
12
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 ...")
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue