Skip to content

Commit 04a254e

Browse files
authored
remove cert verification for oc download (#366)
1 parent 89d8128 commit 04a254e

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

utilities/infra.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import platform
1717
import pytest
1818
import requests
19+
import urllib3
1920
from _pytest._py.path import LocalPath
2021
from _pytest.fixtures import FixtureRequest
2122
from kubernetes.dynamic import DynamicClient
@@ -1184,16 +1185,6 @@ def get_oc_console_cli_download_link() -> str:
11841185
return all_links[0]
11851186

11861187

1187-
def get_server_cert(tmpdir: LocalPath) -> str:
1188-
data = ConfigMap(name="kube-root-ca.crt", namespace="openshift-apiserver", ensure_exists=True).instance.data[
1189-
"ca.crt"
1190-
]
1191-
file_path = os.path.join(tmpdir, "cluster-ca.cert")
1192-
with open(file_path, "w") as fd:
1193-
fd.write(data)
1194-
return file_path
1195-
1196-
11971188
def download_oc_console_cli(tmpdir: LocalPath) -> str:
11981189
"""
11991190
Download and extract the OpenShift CLI binary.
@@ -1209,9 +1200,9 @@ def download_oc_console_cli(tmpdir: LocalPath) -> str:
12091200
"""
12101201
oc_console_cli_download_link = get_oc_console_cli_download_link()
12111202
LOGGER.info(f"Downloading archive using: url={oc_console_cli_download_link}")
1212-
cert_file = get_server_cert(tmpdir=tmpdir)
1203+
urllib3.disable_warnings() # TODO: remove when cert issue is addressed for managed clusters
12131204
local_file_name = os.path.join(tmpdir, oc_console_cli_download_link.split("/")[-1])
1214-
with requests.get(oc_console_cli_download_link, verify=cert_file, stream=True) as created_request:
1205+
with requests.get(oc_console_cli_download_link, verify=False, stream=True) as created_request:
12151206
created_request.raise_for_status()
12161207
with open(local_file_name, "wb") as file_downloaded:
12171208
for chunk in created_request.iter_content(chunk_size=8192):

0 commit comments

Comments
 (0)