aristanetworks / ansible-cvp

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

Fix(cv_device_v3): reconciled configlets are not treated specially #667

Closed noredistribution closed 8 months ago

noredistribution commented 10 months ago

Change Summary

Related Issue(s)

Fixes #666

Component(s) name

arista.cvp.cv_device_v3

Proposed changes

added condition to detect if a configlet is reconciled and in the list of new configlets to be added and append it to the end of the list always

How to test

easiest way to test is to grab a device, add some small changes to the running-config, reconcile, and then create a playbook and specify the same list of configlets as is on the UI but change the order of the reconciled configlet as below

- 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}}"

before this PR a task would be generated, whereas with this PR there should be no tasks generated

Checklist

User Checklist

Repository Checklist

alexeygorbunov commented 8 months ago

Ran few manual tests targeting handling of reconciled configlets (strict and loose modes, attaching and detaching them) - everything worked correctly in all cases.