aristanetworks / ansible-cvp

Ansible modules for Arista CloudVision

Home Page:http://cvp.avd.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug(cv_container_v3): in 3.4.0 cannot use cv_facts_v3 generated output to create container topology due to new imageBundle key

noredistribution opened this issue · comments

Issue Summary

In ansible-cvp 3.4.0 we've added some additional features around imageBundles and also started outputting if containers have image bundles assigned to them, e.g. when running cv_facts_3 the output will be like this:

---
Undefined:
    configlets: []
    image_bundle: EOS-4.25.4M
    parentContainerName: Tenant
containerA:
    configlets:
    - configletA1
    - configletA2
    image_bundle: ''
    parentContainerName: Tenant
containerB:
    configlets:
    - configletB1
    - configletB2
    image_bundle: ''
    parentContainerName: containerA

the issue is that additional properties are not allowed in our schema

setting that to True will fix the issue and any possible future enhancements where this might happen:
https://github.com/aristanetworks/ansible-cvp/blob/devel/ansible_collections/arista/cvp/plugins/module_utils/resources/schemas/v3.py#L241

Which component(s) of AVD impacted

cv_container_v3

How do you run AVD ?

Ansible CLI (with virtual-env or native python)

Input variables

- name: container topology creation
  hosts: CloudVision
  connection: local
  gather_facts: no
  vars:
    # Container definition
    containers_provision:
        Undefined:
            configlets: []
            image_bundle: EOS-4.25.4M
            parentContainerName: Tenant
        containerA:
            configlets:
            - configletA1
            - configletA2
            image_bundle: ''
            parentContainerName: Tenant
        containerB:
            configlets:
            - configletB1
            - configletB2
            image_bundle: ''
            parentContainerName: containerA

  tasks:
    - name: "Build Container topology on {{inventory_hostname}}"
      arista.cvp.cv_container_v3:
        topology: '{{containers_provision}}'

Steps to reproduce

ansible-playbook topo_create2.yaml

Relevant log output

PLAY [container topology creation] *********************************************************************************************

TASK [Build Container topology on CloudVision] ******************************************************************************************
fatal: [CloudVision]: FAILED! => {"changed": false, "msg": "Error, your input is not valid against current schema:\n Undefined"}

PLAY RECAP ******************************************************************************************************************************
CloudVision                : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

Code of Conduct

  • I agree to follow this project's Code of Conduct

I would suggest to add a new keyword image_bundle to the cv_container schema and make sure it's not a required keyword so we don't introduce any breaking change.

Other option is to do a semi-breaking change, and have get_facts_v3 updated to change the image_bundle key to match the imageBundle in the schema.

That was the discussion on PR #505 - keep the schema as sacred...

We could still have get_facts_v3 output an image_bundle key, for anyone that is already using it, but mark it as deprecated. whether or not it should be an optional keyword in the schema... ??