From a4cf9c4119623ad2023aefbe652a424cb567383c Mon Sep 17 00:00:00 2001 From: Kenny Woodson Date: Mon, 30 Jan 2017 16:08:35 -0500 Subject: Adding unit test for oc_service. Added environment fix for non-standard oc installs. --- roles/lib_openshift/library/oc_serviceaccount.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'roles/lib_openshift/library/oc_serviceaccount.py') diff --git a/roles/lib_openshift/library/oc_serviceaccount.py b/roles/lib_openshift/library/oc_serviceaccount.py index ff93b9b23..55ab099f8 100644 --- a/roles/lib_openshift/library/oc_serviceaccount.py +++ b/roles/lib_openshift/library/oc_serviceaccount.py @@ -890,11 +890,13 @@ class OpenShiftCLI(object): def _run(self, cmds, input_data): ''' Actually executes the command. This makes mocking easier. ''' + curr_env = os.environ.copy() + curr_env.update({'KUBECONFIG': self.kubeconfig}) proc = subprocess.Popen(cmds, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, - env={'KUBECONFIG': self.kubeconfig}) + env=curr_env) stdout, stderr = proc.communicate(input_data) @@ -905,9 +907,9 @@ class OpenShiftCLI(object): '''Base command for oc ''' cmds = [] if oadm: - cmds = ['/usr/bin/oadm'] + cmds = ['oadm'] else: - cmds = ['/usr/bin/oc'] + cmds = ['oc'] if self.all_namespaces: cmds.extend(['--all-namespaces']) -- cgit v1.2.3