aristanetworks / ansible-cvp

Ansible modules for Arista CloudVision
http://cvp.avd.sh
Apache License 2.0
65 stars 61 forks source link

Bug(cv_device_v3): reconciled configlets are not treated specially #666

Closed noredistribution closed 8 months ago

noredistribution commented 10 months ago

Issue Summary

when adding reconciled configlets to the list of configlets to be applied, users can define it anywhere in the list, cvp-backend correctly moves it always to the end of the list as it should, however it detects a change (even if it could be a no-op change) and triggers a task (which can be an empty task)

Which component(s) of AVD impacted

cv_device_v3

How do you run AVD ?

Ansible CLI (with virtual-env or native python)

Input variables

- name: Playbook to demonstrate cvp modules.
  hosts: cv_server
  connection: local
  gather_facts: no
  vars:
    # Container definition
    cvp_devices:
      - fqdn: tp-avd-leaf1
        parentContainerName: TP_LEAF1
        configlets:
          - Add-VLAN-50
          - RECONCILE_BAD032986065E8DC14CBB6472EC314A6_3
          - tp-avd_tp-avd-leaf1
  tasks:
    - name: "Configure devices on {{inventory_hostname}}"
      arista.cvp.cv_device_v3:
        devices: '{{cvp_devices}}'
        apply_mode: loose
        state: present
      register: CVP_DEVICES_RESULTS
    - name: debug
      debug:
        msg: "{{CVP_DEVICES_RESULTS}}"

### Steps to reproduce

```shell
Simply running a playbook similar to above where the reconciled config is put anywhere besides the bottom of the list (last index) will result with a task generated, which in case of a no-op change should not happen

Relevant log output

[debug] *************************************************************************************************************
Tuesday 29 August 2023  02:30:56 +0100 (0:00:06.312)       0:00:06.351 ********
ok: [cv_server] =>
  msg:
    bundle_attached:
      bundle_attached_count: 0
      bundle_attached_list: []
      changed: false
      diff: {}
      errors: []
      success: false
      taskIds: []
      warnings: []
    bundle_detached:
      bundle_detached_count: 0
      bundle_detached_list: []
      changed: false
      diff: {}
      errors: []
      success: false
      taskIds: []
      warnings: []
    changed: true
    configlets_attached:
      changed: true
      configlets_attached_count: 3
      configlets_attached_list:
      - tp-avd-leaf1_configlet_attached
      diff: {}
      errors: []
      success: true
      taskIds:
      - '2851'
      warnings: []
    configlets_detached:
      changed: false
      configlets_detached_count: 0
      configlets_detached_list: []
      diff: {}
      errors: []
      success: false
      taskIds: []
      warnings: []
    devices_deployed:
      changed: false
      devices_deployed_count: 0
      devices_deployed_list: []
      diff: {}
      errors: []
      success: false
      taskIds: []
      warnings: []
    devices_moved:
      changed: false
      devices_moved_count: 0
      devices_moved_list: []
      diff: {}
      errors: []
      success: false
      taskIds: []
      warnings: []
    failed: false
    success: true
    taskIds:
    - '2851'

Code of Conduct