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_version.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'roles/lib_openshift/library/oc_version.py') diff --git a/roles/lib_openshift/library/oc_version.py b/roles/lib_openshift/library/oc_version.py index 4a20b72fe..63d16d451 100644 --- a/roles/lib_openshift/library/oc_version.py +++ b/roles/lib_openshift/library/oc_version.py @@ -862,11 +862,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) @@ -877,9 +879,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