Skip to content
Snippets Groups Projects
Commit ca92d281 authored by Mitchell Moore's avatar Mitchell Moore
Browse files

Create placeholder functions for acct. creation. Remove producer

parent c7189b24
No related branches found
No related tags found
1 merge request!35Version 1b openstack rabbitmq
......@@ -43,6 +43,11 @@ def check_dir(user, interval):
def create_account(username, fullname, reason):
# Todo: Ravi's and Louis's code go here
time.sleep(5)
def account_confirmation(username):
# Todo: Ravi's and Louis's code go here
time.sleep(5)
return True
......@@ -56,61 +61,16 @@ def handle_my_custom_event(json, methods=['GET', 'POST']):
def ingest_data(json, methods=['GET', 'POST']):
print (time.strftime("%m-%d-%Y_%H:%M:%S") + '\tQueue request received: ' + str(json))
# RabbitMQ Request Approach
try:
credentials = pika.PlainCredentials('reggie', 'reggie')
parameters = pika.ConnectionParameters('ood',
5672,
'/',
credentials)
connection = pika.BlockingConnection(parameters)
channel = connection.channel()
channel.exchange_declare(exchange='direct_logs', exchange_type='direct')
node = 'ood'
message = str(json)
channel.basic_publish(
exchange='direct_logs', routing_key=node, body=message)
create_account(json['username'], json['fullname'], json['reason'])
print (time.strftime("%m-%d-%Y_%H:%M:%S") + '\tUser ' + json["username"] + ' added to queue')
socketio.emit("creating account")
connection.close()
except Exception as e:
print(time.strftime("%m-%d-%Y_%H:%M:%S") + "\tError in account creation: ", e)
socketio.emit("Account creation failed")
# try:
# fullname = json["fullname"]
# reason = json["reason"]
# username = json["username"]
#
# time_stamp = time.strftime("%m-%d-%Y_%H:%M:%S")
# directory = "flat_db/"
# complete_file_name = os.path.join(directory, time_stamp + "_" + username + ".txt")
#
# if not os.path.exists(directory):
# os.makedirs(directory)
#
# file = open(complete_file_name, "w") # create time stamped file to be queued
#
# file.write(fullname + "\n")
# file.write(reason)
#
# file.close()
# print (time.strftime("%m-%d-%Y_%H:%M:%S") + '\tUser ' + username + ' added to queue')
# socketio.emit("creating account")
#
# except Exception as e:
# print(time.strftime("%m-%d-%Y_%H:%M:%S") + "\tError in directory creation: ", e)
# socketio.emit("Account creation failed")
@socketio.on("validate creation")
def creation_confirmation(json, methods=['GET', 'POST']):
......
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