Skip to content

Commit

Permalink
Merge pull request #147 from hemanthKa677/test_del_network
Browse files Browse the repository at this point in the history
NIOSSPT Ansible cannot delete the network
  • Loading branch information
hemanthKa677 authored Sep 19, 2022
2 parents e8277d0 + 93cd5f3 commit baf619f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ansible-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:

- name: Generate coverage report
run: |
if [ "${{ matrix.ansible-version }}" == "devel" ]; then pip install coverage==6.4.3; fi
if [ "${{ matrix.ansible-version }}" == "devel" ]; then pip install coverage==6.4.4; fi
ansible-test coverage xml -v --group-by command --group-by version
working-directory: /home/runner/.ansible/collections/ansible_collections/infoblox/nios_modules/

Expand Down
8 changes: 8 additions & 0 deletions plugins/module_utils/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,14 @@ def get_object_ref(self, module, ib_obj_type, obj_filter, ib_spec):
if temp:
# reinstate 'create_token' key
ib_spec['create_token'] = temp
elif (ib_obj_type in (NIOS_IPV4_NETWORK, NIOS_IPV6_NETWORK, NIOS_IPV4_NETWORK_CONTAINER, NIOS_IPV6_NETWORK_CONTAINER)):
# del key 'template' as nios_network get_object fails with the key present
temp = ib_spec['template']
del ib_spec['template']
ib_obj = self.get_object(ib_obj_type, obj_filter.copy(), return_fields=list(ib_spec.keys()))
if temp:
# reinstate 'template' key
ib_spec['template'] = temp
else:
ib_obj = self.get_object(ib_obj_type, obj_filter.copy(), return_fields=list(ib_spec.keys()))
return ib_obj, update, new_name
Expand Down
2 changes: 0 additions & 2 deletions plugins/modules/nios_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,13 @@ def check_ip_addr_type(obj_filter, ib_spec):
check_ip = ip.split('/')
del ib_spec['container'] # removing the container key from post arguments
del ib_spec['options'] # removing option argument as for network container it's not supported
del ib_spec['template'] # removing template argument as it is not searchable argument
if validate_ip_address(check_ip[0]):
return NIOS_IPV4_NETWORK_CONTAINER, ib_spec
elif validate_ip_v6_address(check_ip[0]):
return NIOS_IPV6_NETWORK_CONTAINER, ib_spec
else:
check_ip = ip.split('/')
del ib_spec['container'] # removing the container key from post arguments
del ib_spec['template'] # removing template argument as it is not searchable argument
if validate_ip_address(check_ip[0]):
return NIOS_IPV4_NETWORK, ib_spec
elif validate_ip_v6_address(check_ip[0]):
Expand Down

0 comments on commit baf619f

Please sign in to comment.