openshift/openshift-client-python

[Question] sharing context with subprocess

MartykQ opened this issue · 0 comments

Hello,

is there a way to share a context with subprocess library, for example:

import openshift as oc
import subprocess

HOST = 'https://localhost:6443'
USER = 'ocuser'
PASSWORD = 'password'
PROJECT = 'my-proj'

with oc.api_server(HOST):
    with oc.login(USER, PASSWORD):
        with oc.project(PROJECT):
            subprocess.run('oc get pods | grep ABCD')

I would like to execute some commands directly from the subprocess library, making sure I'm in the correct server/project context