Skip to content

Commit 3af3fee

Browse files
committed
Add base_resource_lookup to ResourceList to avoid logging error
As seen in openshift/openshift-restclient-python#430 We are hitting a bunch of these logging errors: ```bash load cache error: __init__() got an unexpected keyword argument 'base_resource_lookup' ``` Which seem like they could be fixed by expecting this arg. We might be off here so would appreciate any pointers, but kept it simple at this point without adding the actual client request support. Signed-off-by: Alex Kalenyuk <[email protected]>
1 parent 2c5f775 commit 3af3fee

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

kubernetes/base/dynamic/resource.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,21 @@ def __getattr__(self, name):
108108
class ResourceList(Resource):
109109
""" Represents a list of API objects """
110110

111-
def __init__(self, client, group='', api_version='v1', base_kind='', kind=None):
111+
def __init__(self, client, group='', api_version='v1', base_kind='', kind=None, base_resource_lookup=None):
112112
self.client = client
113113
self.group = group
114114
self.api_version = api_version
115115
self.kind = kind or '{}List'.format(base_kind)
116116
self.base_kind = base_kind
117+
self.base_resource_lookup = base_resource_lookup
117118
self.__base_resource = None
118119

119120
def base_resource(self):
120121
if self.__base_resource:
121122
return self.__base_resource
123+
elif self.base_resource_lookup:
124+
self.__base_resource = self.client.resources.get(**self.base_resource_lookup)
125+
return self.__base_resource
122126
elif self.base_kind:
123127
self.__base_resource = self.client.resources.get(group=self.group, api_version=self.api_version, kind=self.base_kind)
124128
return self.__base_resource

0 commit comments

Comments
 (0)