Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove interface fails without separators #170

Open
DanielRaapDev opened this issue Feb 12, 2025 · 1 comment · May be fixed by #171
Open

remove interface fails without separators #170

DanielRaapDev opened this issue Feb 12, 2025 · 1 comment · May be fixed by #171
Labels
bug Something isn't working

Comments

@DanielRaapDev
Copy link
Contributor

Describe the bug
We have an existing interface. That should be removed by Ansible with state: absent. When running the step fails with:

Traceback (most recent call last):
  File "/home/ansibleuser/.ansible/tmp/ansible-tmp-1739371697.0629294-164-246873301641437/AnsiballZ_pfsense_interface.py", line 107, in <module>
    _ansiballz_main()
  File "/home/ansibleuser/.ansible/tmp/ansible-tmp-1739371697.0629294-164-246873301641437/AnsiballZ_pfsense_interface.py", line 99, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/ansibleuser/.ansible/tmp/ansible-tmp-1739371697.0629294-164-246873301641437/AnsiballZ_pfsense_interface.py", line 47, in invoke_module
    runpy.run_module(mod_name='ansible_collections.pfsensible.core.plugins.modules.pfsense_interface', init_globals=dict(_module_fqn='ansible_collections.pfsensible.core.plugins.modules.pfsense_interface', _modlib_path=modlib_path),
  File "<frozen runpy>", line 226, in run_module
  File "<frozen runpy>", line 98, in _run_module_code
  File "<frozen runpy>", line 88, in _run_code
  File "/tmp/ansible_pfsensible.core.pfsense_interface_payload_ott_knet/ansible_pfsensible.core.pfsense_interface_payload.zip/ansible_collections/pfsensible/core/plugins/modules/pfsense_interface.py", line 164, in <module>
  File "/tmp/ansible_pfsensible.core.pfsense_interface_payload_ott_knet/ansible_pfsensible.core.pfsense_interface_payload.zip/ansible_collections/pfsensible/core/plugins/modules/pfsense_interface.py", line 159, in main
  File "/tmp/ansible_pfsensible.core.pfsense_interface_payload_ott_knet/ansible_pfsensible.core.pfsense_interface_payload.zip/ansible_collections/pfsensible/core/plugins/module_utils/module_base.py", line 451, in run
  File "/tmp/ansible_pfsensible.core.pfsense_interface_payload_ott_knet/ansible_pfsensible.core.pfsense_interface_payload.zip/ansible_collections/pfsensible/core/plugins/module_utils/module_base.py", line 419, in _remove
  File "/tmp/ansible_pfsensible.core.pfsense_interface_payload_ott_knet/ansible_pfsensible.core.pfsense_interface_payload.zip/ansible_collections/pfsensible/core/plugins/module_utils/interface.py", line 337, in _pre_remove_target_elt
  File "/tmp/ansible_pfsensible.core.pfsense_interface_payload_ott_knet/ansible_pfsensible.core.pfsense_interface_payload.zip/ansible_collections/pfsensible/core/plugins/module_utils/interface.py", line 387, in _remove_all_separators
TypeError: 'NoneType' object is not iterable

Expected behavior
The interface is deleted without errors.

Environment

  • What version of pfsensible.core? master 0.7.0 Commit a2f81e2
  • What version of ansible? 2.15.6
  • What version of pfSense? 2.7.2-RELEASE

Additional context
The code in module_utils/interface.py does not check that no separators exist:

        separators = self.pfsense.rules.find('separator')
        for interface_elt in separators:

When find() does not return anything the iteration is broken :(

@DanielRaapDev DanielRaapDev added the bug Something isn't working label Feb 12, 2025
@DanielRaapDev
Copy link
Contributor Author

DanielRaapDev commented Feb 12, 2025

I created a simple PR #171 to remediate this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant