Skip to content

Commit

Permalink
updated inventoryfun load function to return a list of results for al…
Browse files Browse the repository at this point in the history
…l functions that being called
  • Loading branch information
dmulyalin committed Mar 12, 2023
1 parent d263c17 commit b90b7c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions nornir_salt/plugins/functions/InventoryFun.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,10 @@ def _load(nr, data):
of function to call, rest of the dictionary used as a ``**kwargs`` with
specidfied call function.
"""
for item in data:
fun_name = item.pop("call")
fun_dispatcher[fun_name](nr, **item)
return True
return [
fun_dispatcher[item.pop("call")](nr, **item)
for item in data
]


def _list_hosts(nr, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_InventoryFun.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def test_InventoryFun_load():

res = InventoryFun(nr, "load", data=data)

assert res == True
assert res == [True, True, True, True]
# check hosts deleted/created
assert "IOL2" not in nr.inventory.hosts
assert "IOL3" in nr.inventory.hosts
Expand Down

0 comments on commit b90b7c4

Please sign in to comment.