Skip to content

Commit

Permalink
k8sclient: fix typo in ensure_oc_installed
Browse files Browse the repository at this point in the history
Fix type. Also break the curl into separate commands. The current way it
is written will fail when run on localhost due to the way that
subprocess handles the pipe.

Signed-off-by: Salvatore Daniele <[email protected]>
  • Loading branch information
SalDaniele committed Sep 4, 2024
1 parent 743d635 commit 47cd21d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions k8sClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ def __init__(self, kubeconfig: str, host: host.Host = host.LocalHost()):
def _ensure_oc_installed(self) -> None:
if self._host.run("which oc").returncode == 0:
return
uname = self._host.run_or_die("uname -m").out
url = f"https://mirror.openshift.com/pub/openshift-v4/${uname}/clients/ocp/stable/openshift-client-linux.tar.gz"
self._host.run_or_die(f"curl {url} | sudo tar -U -C /usr/local/bin -xzf -")
uname = self._host.run_or_die("uname -m").out.strip()
url = f"https://mirror.openshift.com/pub/openshift-v4/{uname}/clients/ocp/stable/openshift-client-linux.tar.gz"
self._host.run_or_die(f"curl -L {url} -o /tmp/openshift-client-linux.tar.gz")
self._host.run_or_die("sudo tar -U -C /usr/local/bin -xzf /tmp/openshift-client-linux.tar.gz")

def is_ready(self, name: str) -> bool:
for e in self._client.list_node().items:
Expand Down

0 comments on commit 47cd21d

Please sign in to comment.