diff --git a/ohpc_account_create.py b/ohpc_account_create.py index 4778450079364d44f29bc8382af01beb5b095692..ee69364cfc859143ca6a560ba43469851b1f8d9c 100644 --- a/ohpc_account_create.py +++ b/ohpc_account_create.py @@ -34,12 +34,12 @@ result = channel.queue_declare(queue=queue_name, exclusive=False) channel.queue_bind(exchange=rcfg.Exchange, queue=queue_name, routing_key=queue_name) -def slurm_account_create(ch, method, properties, body): +def ohpc_account_create(ch, method, properties, body): msg = json.loads(body) print("Message received {}".format(msg)) username = msg['username'] try: - subprocess.call(["sudo", "useradd", "-m", username]) + subprocess.call(["sudo", "useradd", username]) print("User {} has been added to {}".format(username, hostname)) except: print("Failed to create user") @@ -51,7 +51,7 @@ def slurm_account_create(ch, method, properties, body): # ingest messages -channel.basic_consume(queue=queue_name, on_message_callback=slurm_account_create) +channel.basic_consume(queue=queue_name, on_message_callback=ohpc_account_create) # initiate message ingestion try: diff --git a/ood_account_create.py b/ood_account_create.py index 326e541facac53f1c720b746f24c7d2c941314b7..2abaa23429cd41e4565a25e2055ec18920713328 100644 --- a/ood_account_create.py +++ b/ood_account_create.py @@ -33,7 +33,7 @@ result = channel.queue_declare(queue=queue_name, exclusive=False) channel.queue_bind(exchange=rcfg.Exchange, queue=queue_name, routing_key=queue_name) -def slurm_account_create(ch, method, properties, body): +def ood_account_create(ch, method, properties, body): msg = json.loads(body) print("Message received {}".format(msg)) username = msg['username'] @@ -41,7 +41,7 @@ def slurm_account_create(ch, method, properties, body): user_gid = str(msg['gid']) try: subprocess.call(["sudo", "groupadd", "-r", "-g", user_gid, username]) - subprocess.call(["sudo", "useradd", "-u", user_uid, "-g", user_gid, "-m", username]) + subprocess.call(["sudo", "useradd", "-u", user_uid, "-g", user_gid, username]) print("User {} has been added to {}".format(username, hostname)) except: print("Failed to create user") @@ -52,7 +52,7 @@ def slurm_account_create(ch, method, properties, body): # ingest messages -channel.basic_consume(queue=queue_name, on_message_callback=slurm_account_create) +channel.basic_consume(queue=queue_name, on_message_callback=ood_account_create) # initiate message ingestion try: