-
Notifications
You must be signed in to change notification settings - Fork 34
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
Apparent uniqueness issue with module_bay_template module #486
Comments
Simple example playbook: ---
- name: Recreate module bay issue
hosts: localhost
gather_facts: false
tasks:
- name: Add manufacturers
networktocode.nautobot.manufacturer:
name: Cisco
state: present
validate_certs: false
- name: Add device types
networktocode.nautobot.device_type:
model: "{{ item['model'] }}"
manufacturer: "{{ item['manufacturer'] }}"
state: present
validate_certs: false
loop:
- model: Device1
manufacturer: Cisco
- model: Device2
manufacturer: Cisco
- name: Add module bay templates
networktocode.nautobot.module_bay_template:
name: "{{ item['name'] }}"
position: "{{ item['position'] }}"
device_type: "{{ item['device_type'] }}"
state: present
validate_certs: false
loop:
- device_type: Device1
name: Slot 1
position: '1'
- device_type: Device2
name: Slot 1
position: '1'
register: module_bay_template_adds
|
You are correct, adding Do you have the cycles to put in the PR or would you like us to take care of it? |
Thanks for doing the PR, had not checked on the status, and like I said, it didn't seem to fix it when I did it, but I only did device_type, and it looks like you did device_type and module_type in the PR. |
There appears to be a uniqueness issue with the module_bay_template module where module bays with the same name on different devices are stepping on one another. So if I invoke the module to create a 'Slot 1' module bay template on say a Nexus 7k, and then I invoke the module again to create a module bay template also called 'Slot 1' on a Nexus 9k chassis, the module is incorrectly updating the existing object, instead of determining that it needs to be a separate object.
I have not fully absorbed the working of the class structure underlying the modules, but these two lines might be relevant:
Interface templates work fine, i.e. multiple mgmt0 ports on multiple devices, and that seems to have its uniqueness defined here with both name and device_type:
https://github.com/nautobot/nautobot-ansible/blob/develop/plugins/module_utils/utils.py#L405
While module_bay_template is defined here with just name:
https://github.com/nautobot/nautobot-ansible/blob/develop/plugins/module_utils/utils.py#L419
Actually, looks like that is the only _template key that does not reference device_type for uniqueness.
Edit: Tried updating that line locally, does not affect the behavior.
The text was updated successfully, but these errors were encountered: