File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -146,14 +146,20 @@ def _populate(self, json):
146146 Parse Nodes into more useful LKENodePoolNode objects
147147 """
148148 if json is not None and json != {}:
149- new_nodes = [
150- (
151- LKENodePoolNode (self ._client , c )
152- if not isinstance (c , dict )
153- else c
154- )
155- for c in json ["nodes" ]
156- ]
149+ new_nodes = []
150+ for c in json ["nodes" ]:
151+ if isinstance (c , dict ):
152+ node_id = c .get ("id" )
153+ if node_id is not None :
154+ new_nodes .append (LKENodePoolNode (self ._client , c ))
155+ else :
156+ raise ValueError (
157+ "Node dictionary does not contain 'id' key"
158+ )
159+ elif isinstance (c , str ):
160+ new_nodes .append (LKENodePoolNode (self ._client , c ))
161+ else :
162+ raise TypeError ("Unsupported node type: {}" .format (type (c )))
157163 json ["nodes" ] = new_nodes
158164
159165 super ()._populate (json )
You can’t perform that action at this time.
0 commit comments