Skip to content
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

Fix(inventory_to_container): Add return guard if no children in inven… #940

Conversation

guillaumeVilar
Copy link
Contributor

Change Summary

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Documentation content changes
  • Other (please describe):

Related Issue(s)

Fixes #939

Component(s) name

arista.avd.eos_config_deploy_cvp

Proposed changes

Add a return guard in avd/plugins/modules/inventory_to_container.py in the get_devices() function in order to avoid the cast issue.

How to test

Playbook:

- hosts: cv_server
  tasks:
    - name: deploy configuration via CVP
      import_role:
         name: arista.avd.eos_config_deploy_cvp
      vars:
        container_root: 'DC1_FABRIC'
        configlets_prefix: 'DC1-AVD'
        device_filter: 'DC1'
        state: present
        execute_tasks: false

Inventory:

    # DC1_Fabric - EVPN Fabric running in home lab
    DC1:
      children:
        DC1_FABRIC:
          children:
            DC1_SPINES:
              hosts:
                DC1-SPINE1:
                  ansible_host: 10.0.0.1
                DC1-SPINE2:
                  ansible_host: 10.0.0.2
            DC1_L3LEAFS:
              children:
                DC1_LEAF1:
                  hosts:
                    DC1-LEAF1A:
                      ansible_host: 10.0.0.3
                    DC1-LEAF1B:
                      ansible_host: 10.0.0.4
            DC1_L2LEAFS:
              children:

Checklist:

  • My code has been rebased from devel before I start
  • I have read the CONTRIBUTING document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have updated molecule CI testing accordingly
  • All new and existing tests passed (pre-commit, make linting and make sanity-lint).

@guillaumeVilar guillaumeVilar added the role: eos_config_deploy_cvp issue related to eos_config_deploy_cvp role label May 10, 2021
@guillaumeVilar guillaumeVilar self-assigned this May 10, 2021
@github-actions github-actions bot added the module: inventory_to_container issue related to inventory_to_container module label May 10, 2021
@carlbuchmann carlbuchmann added the type: bug Something isn't working label May 11, 2021
@carlbuchmann carlbuchmann self-requested a review May 14, 2021 22:55
Copy link
Member

@carlbuchmann carlbuchmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, validated with AVD validation lab!

Current Devel:

TASK [arista.avd.eos_config_deploy_cvp : generate intented variables] ********************************************************************************************************************************************************************
Friday 14 May 2021  18:53:38 -0400 (0:00:00.099)       0:00:00.149 ************ 
Friday 14 May 2021  18:53:38 -0400 (0:00:00.099)       0:00:00.148 ************ 
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'NoneType' object has no attribute 'items'
fatal: [CVP-1]: FAILED! => changed=false 

With PR #940, the play ran successfully.

@carlbuchmann carlbuchmann merged commit 81dcdae into aristanetworks:devel May 14, 2021
@carlbuchmann carlbuchmann added this to the v2.2.0 milestone Jun 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: inventory_to_container issue related to inventory_to_container module role: eos_config_deploy_cvp issue related to eos_config_deploy_cvp role type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

eos_config_deploy_cvp errors if section without children is present in the inventory
2 participants