nautobot-ansible icon indicating copy to clipboard operation
nautobot-ansible copied to clipboard

Entry is constantly changed for fields with the type integer

Open pugnacity opened this issue 4 months ago • 8 comments

ISSUE TYPE
  • Bug Report
SOFTWARE VERSIONS
pynautobot

2.0.2

Ansible:

2.16.2

Nautobot:

21.1

Collection:

5.1.0

SUMMARY

Fields from type interger are reported as changed on every run.

STEPS TO REPRODUCE
    - name: Init InfraDB | unique-rules
      networktocode.nautobot.plugin:
        url: "{{ nautobot_url }}"
        token: "{{ nautobot_token }}"
        validate_certs: "{{ documentation_nautobot['validate_certs'] }}"
        plugin: nautobot-data-validation-engine
        endpoint: unique-rules
        identifiers:
          name: "{{ rule['name'] }}"
        attrs:
          name: "{{ rule['name'] }}"
          content_type: "{{ rule['content_type'] }}"
          enabled: "{{ rule['enabled'] }}"
          error_message: "{{ rule['error_message'] }}"
          max_instances: "{{ rule['max_instances'] | int }}"
          field: "{{ rule['field'] }}"
        state: present
      loop: "{{ infradb_unique_rules }}"
      loop_control:
        loop_var: rule
      tags: rule

This reports on every run:

    "ansible_loop_var": "rule",
    "changed": true,
    "diff": {
        "after": {
            "max_instances": "1"
        },
        "before": {
            "max_instances": 1
        }
    },

I've the same problem with custom fields for a device, here is the type also integer.

EXPECTED RESULTS

no change after creation

pugnacity avatar Feb 13 '24 13:02 pugnacity