From 7ab67155cf8553c7a3d3a2b5f082025cc027fb23 Mon Sep 17 00:00:00 2001
From: Ravi Tripathi <ravi89@uab.edu>
Date: Thu, 6 May 2021 00:58:27 -0500
Subject: [PATCH] Using run instaead of popen for execution of cmsh command to
 wait for the command to run before proceeding.

---
 prod_rmq_agents/get-next-uid-gid.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/prod_rmq_agents/get-next-uid-gid.py b/prod_rmq_agents/get-next-uid-gid.py
index fc3d816..5fbd7e4 100644
--- a/prod_rmq_agents/get-next-uid-gid.py
+++ b/prod_rmq_agents/get-next-uid-gid.py
@@ -9,6 +9,8 @@ import rc_util
 from os import popen
 from rc_rmq import RCRMQ
 import rabbit_config as rcfg
+from subprocess import run
+import shlex
 
 task = "create_account"
 
@@ -21,6 +23,8 @@ args = rc_util.get_args()
 logger = rc_util.get_logger()
 
 # Account creation
+
+
 def create_account(msg):
 
     logger.info(f"Account creation request received: {msg}")
@@ -36,7 +40,7 @@ def create_account(msg):
     cmd += 'commit;"'
 
     if not args.dry_run:
-        popen(cmd)
+        run(shlex.split(cmd))
         time.sleep(rcfg.Delay)
     logger.info(f"Bright command to create user:{cmd}")
 
-- 
GitLab