mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
NSO: handle types for leaf-lists in nso_config (ValueBuilder) (#34986)
Fixes: #34985
This commit is contained in:
committed by
John R Barker
parent
b7f815ba89
commit
0582521f96
@@ -446,14 +446,20 @@ class ValueBuilder(object):
|
||||
|
||||
schema = self._find_child(parent_path, parent_schema, key)
|
||||
if self._is_leaf(schema):
|
||||
path_type = schema['type']
|
||||
if path_type.get('primitive', False):
|
||||
return path_type['name']
|
||||
else:
|
||||
path_type_key = '{0}:{1}'.format(
|
||||
path_type['namespace'], path_type['name'])
|
||||
type_info = meta['types'][path_type_key]
|
||||
return type_info[-1]['name']
|
||||
def get_type(meta, curr_type):
|
||||
if curr_type.get('primitive', False):
|
||||
return curr_type['name']
|
||||
if 'namespace' in curr_type:
|
||||
curr_type_key = '{0}:{1}'.format(
|
||||
curr_type['namespace'], curr_type['name'])
|
||||
type_info = meta['types'][curr_type_key][-1]
|
||||
return get_type(meta, type_info)
|
||||
if 'leaf_type' in curr_type:
|
||||
return get_type(meta, curr_type['leaf_type'][-1])
|
||||
return curr_type['name']
|
||||
|
||||
return get_type(meta, schema['type'])
|
||||
|
||||
return None
|
||||
|
||||
def _ensure_schema_cached(self, path):
|
||||
|
||||
Reference in New Issue
Block a user