Skip to content
This repository was archived by the owner on Mar 13, 2022. It is now read-only.

Commit 6023e11

Browse files
authored
Merge pull request #253 from schneesu/fix_unsuitable_raise
fix: ignore NotFoundError in the first call of LazyDiscoverer. __search
2 parents 21f1d7f + c040d87 commit 6023e11

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

dynamic/discovery.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,11 @@ def api_groups(self):
237237
return self.parse_api_groups(request_resources=False, update=True)['apis'].keys()
238238

239239
def search(self, **kwargs):
240-
results = self.__search(self.__build_search(**kwargs), self.__resources, [])
240+
# In first call, ignore ResourceNotFoundError and set default value for results
241+
try:
242+
results = self.__search(self.__build_search(**kwargs), self.__resources, [])
243+
except ResourceNotFoundError:
244+
results = []
241245
if not results:
242246
self.invalidate_cache()
243247
results = self.__search(self.__build_search(**kwargs), self.__resources, [])

0 commit comments

Comments
 (0)