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

Handling of configurations blocks with end-* at the end of the block #39673

Merged
merged 5 commits into from May 8, 2018
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/ansible/module_utils/network/common/config.py
Expand Up @@ -290,6 +290,9 @@ def _diff_line(self, other):
for item in self.items:
if item not in other:
updates.append(item)
# special trailing parents need to be included in diff
elif item.line == 'end-policy' or item.line == 'end-set':
Copy link
Member

Choose a reason for hiding this comment

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

It seems this configuration is specific for a particular platform. Is it possible to sanitize the config indentation in the module code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right now there is no platform specific instance of NetworkConfig. It can be done to inherit this class at iosxr code and overwrite function 'difference' and 'diff_exact' to handle these special commands. will that work ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pros of above approach: no extra check penalty for other OS, no regression on other
con: code duplication and fixes in common code would need to be ported

updates.append(item)
return updates

def _diff_strict(self, other):
Expand Down