def run_piped_commands(cmd_a, cmd_b): proc_a = subprocess.Popen( cmd_a, stdout=subprocess.PIPE, cwd="/opt/stack/new/tempest", preexec_fn=demote(*get_stack_user_info()) ) proc_b = subprocess.Popen( cmd_b, stdin=proc_a.stdout, stdout=subprocess.PIPE, cwd="/opt/stack/new/tempest", preexec_fn=demote(*get_stack_user_info()), ) proc_a.stdout.close() return proc_b.communicate()[0]
def create_stack(): subprocess.call(['chown', 'stack:stack', '/tmp/devstack', '-R']) subprocess.call(['chmod', '+755', '/tmp/devstack/stack.sh']) subprocess.call(['/tmp/devstack/stack.sh'], preexec_fn=demote( *get_stack_user_info()))
def initialize_tempest(path, uid, gid): subprocess.call(["testr", "init"], cwd=path, preexec_fn=demote(*get_stack_user_info()))