Skip to content

Commit

Permalink
[FIX] Removed older PIP added by community PR #146 (#256)
Browse files Browse the repository at this point in the history
* [FIX] Removed older PIP added by community PR #146

* [FIX] Sanity issue on nios_next_network
  • Loading branch information
JkhatriInfobox authored Sep 11, 2024
1 parent 1c94771 commit 74e785c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ansible-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
python-version: '3.11'

- name: Install ansible (${{ matrix.ansible-version }})
run: pip install pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible-version }}.tar.gz --disable-pip-version-check
run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible-version }}.tar.gz --disable-pip-version-check

- name: Build a collection tarball
run: ansible-galaxy collection build --output-path "${GITHUB_WORKSPACE}/.cache/collection-tarballs"
Expand Down
15 changes: 8 additions & 7 deletions plugins/lookup/nios_next_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@
networkaddr: "{{ lookup('infoblox.nios_modules.nios_next_network', '192.168.10.0/24', cidr=25, exclude=['192.168.10.0/25'],
provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}"
- name: return the available ipv6 network addresses for network-container 2001:1:111:1::0/64
set_fact:
networkaddr: "{{ lookup('infoblox.nios_modules.nios_next_network', '2001:1:111:1::0/64', cidr=126,
provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}"
- name: return the available ipv6 network addresses for network-container 2001:1:111:1::0/64
set_fact:
networkaddr: "{{ lookup('infoblox.nios_modules.nios_next_network', '2001:1:111:1::0/64', cidr=126,
provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}"
"""

RETURN = """
Expand All @@ -90,6 +90,7 @@
from ..module_utils.api import NIOS_IPV4_NETWORK_CONTAINER, NIOS_IPV6_NETWORK_CONTAINER
import ipaddress


class LookupModule(LookupBase):

def run(self, terms, variables=None, **kwargs):
Expand All @@ -106,7 +107,7 @@ def run(self, terms, variables=None, **kwargs):
raise AnsibleError('missing CIDR argument in the form of xx')

if network.prefixlen >= cidr:
raise AnsibleError('cidr %s must be greater than parent network cidr %s' % (cidr,network.prefixlen))
raise AnsibleError('cidr %s must be greater than parent network cidr %s' % (cidr, network.prefixlen))

container_type = None
network_objects = None
Expand All @@ -125,14 +126,14 @@ def run(self, terms, variables=None, **kwargs):

# check for valid subnetting cidr
if network.prefixlen >= cidr:
raise AnsibleError('cidr %s must be greater than parent network cidr %s' % (cidr,network.prefixlen))
raise AnsibleError('cidr %s must be greater than parent network cidr %s' % (cidr, network.prefixlen))

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

if container_type is None:
raise AnsibleError('unable to identify network-container type')

network_objects = wapi.get_object(container_type, {'network': network.with_prefixlen})

if network_objects is None:
Expand Down
2 changes: 0 additions & 2 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
pip==20.3.4; python_version == '2.6' or python_version=='2.7'
pip==22.2.2; python_version > '3.0'
infoblox-client
pytest
pytest-xdist
Expand Down
2 changes: 0 additions & 2 deletions tests/unit/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
pip==20.3.4; python_version == '2.6' or python_version=='2.7'
pip==22.2.2; python_version > '3.0'
infoblox-client
pytest
pytest-forked
Expand Down

0 comments on commit 74e785c

Please sign in to comment.