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

nios_host_record module doesn't allow to remove an alias/cname #1335

Closed
pescobar opened this issue Nov 20, 2020 · 4 comments
Closed

nios_host_record module doesn't allow to remove an alias/cname #1335

pescobar opened this issue Nov 20, 2020 · 4 comments
Labels
bug This issue/PR relates to a bug module module needs_triage net_tools plugins plugin (any type) python3

Comments

@pescobar
Copy link
Contributor

pescobar commented Nov 20, 2020

SUMMARY

When updating a host object to remove an alias (CNAME) module nios_host_record doesn't detect the removed alias and doesn't update the host object. It only updates the host object when adding extra aliases.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

nios_host_record

ANSIBLE VERSION
ansible 2.9.9
  config file = /home/ansible/ansible/playbooks/playbook-scicore-domains/ansible.cfg
  configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/venvs_ansible/ansible_2.9.9/lib/python3.6/site-packages/ansible
  executable location = /opt/venvs_ansible/ansible_2.9.9/bin/ansible
  python version = 3.6.8 (default, Nov 21 2019, 19:31:34) [GCC 8.3.1 20190507 (Red Hat 8.3.1-4)]
CONFIGURATION
ansible-config dump --only-changed
COLLECTIONS_PATHS(/home/ansible/ansible/playbooks/playbook-scicore-domains/ansible.cfg) = ['/home/ansible/ansible/playbooks/playbook-scicore-domains/collections']
OS / ENVIRONMENT

We are running ansible on centos8 with python 3.6.8
collection community.general version 1.2.0
wapi_version: "2.3.1"
infoblox-client==0.5.0

STEPS TO REPRODUCE

When executing this playbook the second task doesn't change. Doesn't update the host object

---

- name: testing cnames
  hosts: localhost
  gather_facts: false
  become: no

  tasks:

    - name: Add host object with two aliases
      community.general.nios_host_record:
        name: testing-cnames.scicore.unibas.ch
        ipv4addrs:
          - address: 10.10.20.20
        aliases:
          - testing-cnames1.scicore.unibas.ch
          - testing-cnames2.scicore.unibas.ch
        state: present
        view: Internal
        provider: "{{ vault_nios_provider }}"

    - name: I try to delete one alias. IT DOESN'T WORK
      community.general.nios_host_record:
        name: testing-cnames.scicore.unibas.ch
        ipv4addrs:
          - address: 10.10.20.20
        aliases:
          - testing-cnames1.scicore.unibas.ch
        state: present
        view: Internal
        provider: "{{ vault_nios_provider }}"

    - name: I add a new extra alias. Now the alias to be removed in previous task is actually removed
      community.general.nios_host_record:
        name: testing-cnames.scicore.unibas.ch
        ipv4addrs:
          - address: 10.10.20.20
        aliases:
          - testing-cnames1.scicore.unibas.ch
          - testing-cnames3.scicore.unibas.ch
        state: present
        view: Internal
        provider: "{{ vault_nios_provider }}"
EXPECTED RESULTS

host object is updated removing an alias

ACTUAL RESULTS

host object is not updated and no alias is removed

EXTRA INFO

Checking the code I think the problem can be in this block of code https://github.com/ansible-collections/community.general/blob/main/plugins/module_utils/net_tools/nios/api.py#L433-L469 because function issubset will return true when removing an element from the list of aliases and thus the host object is not updated.

@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot ansibullbot added affects_2.10 bug This issue/PR relates to a bug module module needs_triage net_tools plugins plugin (any type) python3 labels Nov 20, 2020
@pescobar
Copy link
Contributor Author

ping

pescobar added a commit to pescobar/community.general that referenced this issue Dec 10, 2020
felixfontein added a commit that referenced this issue Dec 14, 2020
* fix for #1335

* added changelog fragment

* Update changelogs/fragments/nios_host_record-fix-aliases-removal.yml

Co-authored-by: Felix Fontein <[email protected]>

* extend changelog to specify CNAMES

Co-authored-by: Felix Fontein <[email protected]>
patchback bot pushed a commit that referenced this issue Dec 14, 2020
* fix for #1335

* added changelog fragment

* Update changelogs/fragments/nios_host_record-fix-aliases-removal.yml

Co-authored-by: Felix Fontein <[email protected]>

* extend changelog to specify CNAMES

Co-authored-by: Felix Fontein <[email protected]>
(cherry picked from commit 496be77)
@pescobar
Copy link
Contributor Author

This issue is fixed in #1470 so I am closing it

felixfontein pushed a commit that referenced this issue Dec 15, 2020
* fix for #1335

* added changelog fragment

* Update changelogs/fragments/nios_host_record-fix-aliases-removal.yml

Co-authored-by: Felix Fontein <[email protected]>

* extend changelog to specify CNAMES

Co-authored-by: Felix Fontein <[email protected]>
(cherry picked from commit 496be77)

Co-authored-by: Pablo Escobar Lopez <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug module module needs_triage net_tools plugins plugin (any type) python3
Projects
None yet
Development

No branches or pull requests

2 participants