Skip to content

Commit

Permalink
Set variable for ipv4addrs in nios_inventory.py (#271)
Browse files Browse the repository at this point in the history
* Update nios_inventory.py

Set inventory variable for 'ipv4addrs'

* Updated changelog

* Mapped `ipv4addrs` list to 'ipv4addr` attribute.

Mapped `ipv4addrs` list to 'ipv4addr` attribute.
  • Loading branch information
dmnagornyi authored Jan 21, 2025
1 parent 5f381e5 commit fec7059
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/nios_inventory-var_fix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- nios_inventory.py - added 'ipv4addrs' inventory variable
1 change: 1 addition & 0 deletions plugins/inventory/nios_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def parse(self, inventory, loader, path, cache=True): # Plugin interface (2)
self.inventory.add_child(group_name, host_name)

self.inventory.set_variable(host_name, 'view', host['view'])
self.inventory.set_variable(host_name, 'ipv4addrs', [item['ipv4addr'] for item in host['ipv4addrs']])

for key, value in iteritems(flatten_extattrs(host['extattrs'])):
self.inventory.set_variable(host_name, key, value)

0 comments on commit fec7059

Please sign in to comment.