Allow querying for multiple node types.
This commit is contained in:
parent
33b52cc8a9
commit
8f2b0f8faa
@ -236,7 +236,7 @@ async def get_project_uuid(project_url: str) -> str:
|
||||
|
||||
|
||||
async def get_nodes(project_uuid: str = None, parent_node_uuid: str = None,
|
||||
node_type: str = None) -> list:
|
||||
node_type = None) -> list:
|
||||
"""Gets nodes for either a project or given a parent node.
|
||||
|
||||
@param project_uuid: the UUID of the project, or None if only querying by parent_node_uuid.
|
||||
@ -261,7 +261,10 @@ async def get_nodes(project_uuid: str = None, parent_node_uuid: str = None,
|
||||
where['project'] = project_uuid
|
||||
|
||||
if node_type:
|
||||
if isinstance(node_type, str):
|
||||
where['node_type'] = node_type
|
||||
else:
|
||||
where['node_type'] = {'$in': node_type}
|
||||
|
||||
children = await pillar_call(pillarsdk.Node.all, {
|
||||
'projection': {'name': 1, 'parent': 1, 'node_type': 1,
|
||||
|
Reference in New Issue
Block a user