Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion openshift/dynamic/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from kubernetes.client.rest import ApiException

from openshift.dynamic.exceptions import ResourceNotFoundError, ResourceNotUniqueError, api_exception, KubernetesValidateMissing
from urllib3.exceptions import ProtocolError, MaxRetryError

try:
import kubernetes_validate
Expand Down Expand Up @@ -671,7 +672,16 @@ def parse_api_groups(self, request_resources=False, update=False):

def _load_server_info(self):
if not self._cache.get('version'):
self._cache['version'] = {'kubernetes': load_json(self.client.request('get', '/version'))}
try:
self._cache['version'] = {'kubernetes': load_json(self.client.request('get', '/version'))}
except (ValueError, MaxRetryError) as e:
if isinstance(e, MaxRetryError) and not isinstance(e.reason, ProtocolError):
raise
if not self.client.configuration.host.startswith("https://"):
raise ValueError("Host value %s should start with https:// when talking to HTTPS endpoint" %
self.client.configuration.host)
else:
raise
try:
self._cache['version']['openshift'] = load_json(self.client.request('get', '/version/openshift'))
except ApiException:
Expand Down