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

"delete" lines which only delete candidate config shouldn't be ignored #532

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Zmegolaz
Copy link

@Zmegolaz Zmegolaz commented Aug 9, 2024

SUMMARY

The filter_delete_statements() function is intended to remove delete statements which doesn't delete anything in the running config. If there aren't any matching set statements in the running config, the delete statement is deleted. However it doesn't take the previous statements from the candidate config into consideration.

This change walks through all statements above each delete statement of the candidate config and removes them if they match.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

junos_config

ADDITIONAL INFORMATION

Config task:

- name: Apply router config.
  junipernetworks.junos.junos_config:
    lines:
      - set groups ANSIBLETEST interfaces irb unit 102 description "bar"
      - delete groups ANSIBLETEST interfaces irb unit 102 description

Output before change:

TASK [../roles/net_routerconfig : Apply router config.] *****************************************************
[edit groups ANSIBLETEST interfaces irb]
+     unit 102 {
+         description bar;
+     }
changed: [router1]

Output after change:

TASK [../roles/net_routerconfig : Apply router config.] *****************************************************
ok: [router1]

@Zmegolaz
Copy link
Author

Zmegolaz commented Oct 7, 2024

An alternative to this is to remove the de duplicator altogether, let Junos figure it out instead of trying to replicate its behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant