cisco.ios icon indicating copy to clipboard operation
cisco.ios copied to clipboard

add support for src plus match:exact (revive abandoned pull request)

Open amalmborg97 opened this issue 10 months ago • 8 comments

SUMMARY

This is a restoration of PR https://github.com/ansible-collections/cisco.ios/pull/778 initially submitted by @bentole. This feature would be fantastic and I would love to see it to the finish line. The only modification I have made is providing a changelog fragment.

Below is his initial PR description.


Fixes https://github.com/ansible-collections/cisco.ios/issues/655 Fixes https://github.com/ansible-collections/cisco.ios/issues/740 Fixes https://github.com/ansible-collections/cisco.ios/issues/771 Fixes https://github.com/ansible-collections/cisco.ios/issues/129 (related)

Add support for device configuration to exactly match the provided template configuration guaranteeing consistency and idempotency.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

cisco.ios.ios_config

ADDITIONAL INFORMATION

Feature best described by using an example:

play

- name: Make sure running-config exactly matches the template
  cisco.ios.ios_config:
    match: exact
    src: template.j2

template.j2

class-map match-all FOO
 description I am FOO
 match dscp af41
class-map match-all BAR
 description I am BAR
 match dscp af31

running-config before

class-map match-all FOO
 match dscp af42
 match dscp af43

commands fired

class-map match-all FOO
 no match dscp af42
 no match dscp af43
 description I am FOO
 match dscp af41
class-map match-all BAR
 description I am BAR
 match dscp af31

running-config after

class-map match-all FOO
 description I am FOO
 match dscp af41 
class-map match-all BAR
 description I am BAR
 match dscp af31 

Consecutive Runs: changed: false aka Idempotent!

amalmborg97 avatar Apr 02 '24 23:04 amalmborg97

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 86.80%. Comparing base (c9841b5) to head (3e60598). Report is 14 commits behind head on main.

:exclamation: Current head 3e60598 differs from pull request most recent head cac56a2

Please upload reports for the commit cac56a2 to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1050      +/-   ##
==========================================
- Coverage   86.90%   86.80%   -0.10%     
==========================================
  Files         193      199       +6     
  Lines       11904    12077     +173     
==========================================
+ Hits        10345    10484     +139     
- Misses       1559     1593      +34     

see 70 files with indirect coverage changes

codecov[bot] avatar Apr 02 '24 23:04 codecov[bot]

Build failed. https://ansible.softwarefactory-project.io/zuul/buildset/2b0d1f5bcf36452fb5cd07c9407c5dee

:heavy_check_mark: ansible-galaxy-importer SUCCESS in 5m 06s :heavy_check_mark: build-ansible-collection SUCCESS in 13m 11s :x: ansible-ee-integration-ios-latest RETRY_LIMIT in 3m 21s (non-voting) :x: ansible-ee-integration-ios-stable-2.9 FAILURE in 14m 52s (non-voting) :x: ansible-ee-integration-ios-stable-2.11 RETRY_LIMIT in 3m 11s (non-voting) :x: ansible-ee-integration-ios-stable-2.12 RETRY_LIMIT in 3m 32s (non-voting) :x: ansible-ee-integration-ios-libssh-latest RETRY_LIMIT in 3m 02s (non-voting) :x: ansible-ee-integration-ios-libssh-stable-2.9 FAILURE in 37m 08s (non-voting) :x: ansible-ee-integration-ios-libssh-stable-2.11 RETRY_LIMIT in 3m 30s (non-voting) :x: ansible-ee-integration-ios-libssh-stable-2.12 RETRY_LIMIT in 3m 09s (non-voting) :x: ansible-tox-linters FAILURE in 15m 10s

Build failed. https://ansible.softwarefactory-project.io/zuul/buildset/d026455b533740d7847bc1fca3f7a3c4

:warning: ansible-galaxy-importer SKIPPED Skipped due to failed job build-ansible-collection :x: build-ansible-collection RETRY_LIMIT in 8m 08s :warning: ansible-ee-integration-ios-latest SKIPPED Skipped due to failed job build-ansible-collection (non-voting) :warning: ansible-ee-integration-ios-stable-2.9 SKIPPED Skipped due to failed job build-ansible-collection (non-voting) :warning: ansible-ee-integration-ios-stable-2.11 SKIPPED Skipped due to failed job build-ansible-collection (non-voting) :warning: ansible-ee-integration-ios-stable-2.12 SKIPPED Skipped due to failed job build-ansible-collection (non-voting) :warning: ansible-ee-integration-ios-libssh-latest SKIPPED Skipped due to failed job build-ansible-collection (non-voting) :warning: ansible-ee-integration-ios-libssh-stable-2.9 SKIPPED Skipped due to failed job build-ansible-collection (non-voting) :warning: ansible-ee-integration-ios-libssh-stable-2.11 SKIPPED Skipped due to failed job build-ansible-collection (non-voting) :warning: ansible-ee-integration-ios-libssh-stable-2.12 SKIPPED Skipped due to failed job build-ansible-collection (non-voting) :x: ansible-tox-linters RETRY_LIMIT in 8m 39s

recheck

amalmborg97 avatar Apr 03 '24 19:04 amalmborg97

Build failed. https://ansible.softwarefactory-project.io/zuul/buildset/f52b5d729f7a4eaab55ccb66a6bf012d

:warning: ansible-galaxy-importer SKIPPED Skipped due to failed job build-ansible-collection :x: build-ansible-collection RETRY_LIMIT in 4m 10s :warning: ansible-ee-integration-ios-latest SKIPPED Skipped due to failed job build-ansible-collection (non-voting) :warning: ansible-ee-integration-ios-stable-2.9 SKIPPED Skipped due to failed job build-ansible-collection (non-voting) :warning: ansible-ee-integration-ios-stable-2.11 SKIPPED Skipped due to failed job build-ansible-collection (non-voting) :warning: ansible-ee-integration-ios-stable-2.12 SKIPPED Skipped due to failed job build-ansible-collection (non-voting) :warning: ansible-ee-integration-ios-libssh-latest SKIPPED Skipped due to failed job build-ansible-collection (non-voting) :warning: ansible-ee-integration-ios-libssh-stable-2.9 SKIPPED Skipped due to failed job build-ansible-collection (non-voting) :warning: ansible-ee-integration-ios-libssh-stable-2.11 SKIPPED Skipped due to failed job build-ansible-collection (non-voting) :warning: ansible-ee-integration-ios-libssh-stable-2.12 SKIPPED Skipped due to failed job build-ansible-collection (non-voting) :x: ansible-tox-linters RETRY_LIMIT in 9m 40s

I'm sorry for the tag, I need a maintainer to approve the workflow. Is there anything you need from me before the workflow is approved?

Thanks!

@KB-perByte

amalmborg97 avatar Apr 09 '24 19:04 amalmborg97

CC @roverflow

KB-perByte avatar May 31 '24 13:05 KB-perByte

Hey @amalmborg97, could you please add some tests for the above change!

roverflow avatar Jun 10 '24 12:06 roverflow