Skip to content

Commit 74d56c6

Browse files
wmlynchfabianvf
authored andcommitted
Ignore ServiceUnavailableError for an all resource group search (#350)
There are situations where a given api service unrelated to the requested resource is unavailable and an ServiceUnavailableError exception is thrown. The change in this PR will allow resources to be found if the resource being requested is unrelated to an api service that is unavailable. Resolves #349
1 parent 3ec51ae commit 74d56c6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

openshift/dynamic/discovery.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from urllib3.exceptions import ProtocolError, MaxRetryError
1010

1111
from openshift import __version__
12-
from .exceptions import ResourceNotFoundError, ResourceNotUniqueError, ApiException
12+
from .exceptions import ResourceNotFoundError, ResourceNotUniqueError, ApiException, ServiceUnavailableError
1313
from .resource import Resource, ResourceList
1414

1515

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

184184
path = '/'.join(filter(None, [prefix, group, version]))
185-
resources_response = self.client.request('GET', path).resources or []
185+
try:
186+
resources_response = self.client.request('GET', path).resources or []
187+
except ServiceUnavailableError:
188+
resources_response = []
186189

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

0 commit comments

Comments
 (0)