Skip to content

Commit

Permalink
- added network_view in get object search. (#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
JchhatbarInfoblox authored Jul 17, 2024
1 parent d0dd285 commit 421e971
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugins/lookup/nios_next_ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,20 @@ def run(self, terms, variables=None, **kwargs):

provider = kwargs.pop('provider', {})
wapi = WapiLookup(provider)
network_view = kwargs.get('network_view', 'default')

if isinstance(ipaddress.ip_network(network), ipaddress.IPv6Network):
object_type = 'ipv6range' if kwargs.get('use_range', False) else 'ipv6network'
else:
object_type = 'range' if kwargs.get('use_range', False) else 'network'

network_obj = wapi.get_object(object_type, {'network': network})
network_obj = wapi.get_object(object_type, {'network': network, 'network_view': network_view})

if network_obj is None:
raise AnsibleError('unable to find network object %s' % network)

num = kwargs.get('num', 1)
exclude_ip = kwargs.get('exclude', [])
network_view = kwargs.get('network_view', 'default')

ref_list = [network['_ref'] for network in network_obj if network['network_view'] == network_view]
if not ref_list:
Expand Down

0 comments on commit 421e971

Please sign in to comment.