Skip to content

Ignore ServiceUnavailableError for an all resource group search #350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 2, 2020
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
7 changes: 5 additions & 2 deletions openshift/dynamic/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from urllib3.exceptions import ProtocolError, MaxRetryError

from openshift import __version__
from .exceptions import ResourceNotFoundError, ResourceNotUniqueError, ApiException
from .exceptions import ResourceNotFoundError, ResourceNotUniqueError, ApiException, ServiceUnavailableError
from .resource import Resource, ResourceList


Expand Down Expand Up @@ -182,7 +182,10 @@ def get_resources_for_api_version(self, prefix, group, version, preferred):
subresources = {}

path = '/'.join(filter(None, [prefix, group, version]))
resources_response = self.client.request('GET', path).resources or []
try:
resources_response = self.client.request('GET', path).resources or []
except ServiceUnavailableError:
resources_response = []

resources_raw = list(filter(lambda resource: '/' not in resource['name'], resources_response))
subresources_raw = list(filter(lambda resource: '/' in resource['name'], resources_response))
Expand Down