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
|
import string
|
||||||
from lc_ldap import crans_utils
|
from lc_ldap import crans_utils
|
||||||
|
|
||||||
|
import config
|
||||||
|
|
||||||
CREDS = pika.credentials.PlainCredentials('oie', secrets.get('rabbitmq_oie'), True)
|
CREDS = pika.credentials.PlainCredentials('oie', secrets.get('rabbitmq_oie'), True)
|
||||||
import sys
|
import sys
|
||||||
if '--debug' in sys.argv[1:]:
|
if '--debug' in sys.argv[1:]:
|
||||||
|
@ -23,8 +25,10 @@ ch = rabbit_c.channel()
|
||||||
if '--debug' in sys.argv[1:]:
|
if '--debug' in sys.argv[1:]:
|
||||||
QUEUE_NAME = 'CransTicketDebug'
|
QUEUE_NAME = 'CransTicketDebug'
|
||||||
print("Debug")
|
print("Debug")
|
||||||
|
elif '--aux' in sys.argv[1:]:
|
||||||
|
QUEUE_NAME = config.AUXQUEUE
|
||||||
else:
|
else:
|
||||||
QUEUE_NAME = 'CransTicket'
|
QUEUE_NAME = config.MAINQUEUE
|
||||||
ch.queue_declare(QUEUE_NAME)
|
ch.queue_declare(QUEUE_NAME)
|
||||||
|
|
||||||
def gen_password():
|
def gen_password():
|
||||||
|
@ -35,9 +39,9 @@ def gen_password():
|
||||||
return ''.join([random.choice(chars) for _ in xrange(length)])
|
return ''.join([random.choice(chars) for _ in xrange(length)])
|
||||||
|
|
||||||
class Ticket(object):
|
class Ticket(object):
|
||||||
|
|
||||||
data = []
|
data = []
|
||||||
|
|
||||||
def add_entry(self, x):
|
def add_entry(self, x):
|
||||||
self.data.append(x)
|
self.data.append(x)
|
||||||
|
|
||||||
|
@ -103,4 +107,4 @@ class Ticket(object):
|
||||||
ch.basic_publish(exchange='', routing_key=QUEUE_NAME,
|
ch.basic_publish(exchange='', routing_key=QUEUE_NAME,
|
||||||
body=json.dumps(self.data))
|
body=json.dumps(self.data))
|
||||||
print("Un nouveau ticket est en cours d'impression ...")
|
print("Un nouveau ticket est en cours d'impression ...")
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,8 @@ for arg in sys.argv[1:]:
|
||||||
conf_reset_password = True
|
conf_reset_password = True
|
||||||
elif arg == '--debug':
|
elif arg == '--debug':
|
||||||
pass
|
pass
|
||||||
|
elif arg == '--aux':
|
||||||
|
pass
|
||||||
elif arg.startswith('--'):
|
elif arg.startswith('--'):
|
||||||
print("Unknown arg")
|
print("Unknown arg")
|
||||||
exit(12)
|
exit(12)
|
||||||
|
@ -47,7 +49,7 @@ else:
|
||||||
item = res[0]
|
item = res[0]
|
||||||
if 'uid' not in item:
|
if 'uid' not in item:
|
||||||
conf_reset_password = False
|
conf_reset_password = False
|
||||||
|
|
||||||
item.display()
|
item.display()
|
||||||
if conf_reset_password:
|
if conf_reset_password:
|
||||||
print("Le mot de passe (compte Crans) sera également réinitialisé")
|
print("Le mot de passe (compte Crans) sera également réinitialisé")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue