Skip to content
Snippets Groups Projects
Commit 14d8c5b8 authored by Krish Moodbidri's avatar Krish Moodbidri
Browse files

decode json object, create account usinf rc_util call, wait for account...

decode json object, create account usinf rc_util call, wait for account creation to complete using rc_util.consume
parent 67411789
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ import time ...@@ -3,6 +3,7 @@ import time
from flask_socketio import SocketIO from flask_socketio import SocketIO
import subprocess import subprocess
import vars import vars
import rc_util
from gevent import monkey from gevent import monkey
monkey.patch_all(subprocess=True) monkey.patch_all(subprocess=True)
...@@ -19,12 +20,17 @@ def send_msg(event, room): ...@@ -19,12 +20,17 @@ def send_msg(event, room):
@celery.task @celery.task
def celery_create_account(username, fullname, reason, session): def celery_create_account(json, session):
room = session room = session
username= json['username']
email= json['email']
fullname= json['fullname']
reason= json['reason']
print(time.strftime("%m-%d-%Y_%H:%M:%S") + '\tUser ' + username + ' added to queue') print(time.strftime("%m-%d-%Y_%H:%M:%S") + '\tUser ' + username + ' added to queue')
send_msg('creating account', room) send_msg('creating account', room)
print(username) print(username)
subprocess.call(["/opt/rabbitmq_agents/create_account.py", username, email, fullname, reason]) #subprocess.call(["/opt/rabbitmq_agents/create_account.py", username, email, fullname, reason])
print(username + email + fullname + reason) rc_util.add_account(username, email, fullname, reason)
rc_util.consume(username)
print(time.strftime("%m-%d-%Y_%H:%M:%S") + '\tAccount successfully created for ' + username) print(time.strftime("%m-%d-%Y_%H:%M:%S") + '\tAccount successfully created for ' + username)
send_msg('account ready', room) send_msg('account ready', room)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment