Skip to content

Commit

Permalink
Merge pull request #20 from marcom4rtinez/stable
Browse files Browse the repository at this point in the history
dont allow invalid mappings
  • Loading branch information
marcom4rtinez authored Jun 13, 2024
2 parents a8b4896 + 45d9cfd commit 2bd813d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nornir_infrahub/plugins/inventory/infrahub.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ def resolve_node_mapping(node: InfrahubNodeSync, attrs: List[str]) -> Any:
}
mapper = value_mapper.get(node_attr._schema.kind, lambda value: value)
return mapper(node_attr.value)
raise RuntimeError("Unable to resolve mapping")
else:
raise RuntimeError("Unable to resolve mapping")


def _get_connection_options(data: Dict[str, Any]) -> Dict[str, ConnectionOptions]:
Expand Down Expand Up @@ -232,7 +233,6 @@ def load(self) -> Inventory: # noqa: PLR0912
try:
extracted_groups.append(f"{attrs[0]}__{slugify(resolve_node_mapping(host_node, attrs))}")
except RuntimeError:
print(f"Unable to extract group for {attrs}")
# TODO: what do we do in this case?
continue

Expand Down

0 comments on commit 2bd813d

Please sign in to comment.