-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: xlate openconfig-system-ext:track-interface when sending to tes… (
#31) * feat: xlate openconfig-system-ext:track-interface when sending to test devices * feat: remove VTY ACLs when sending configs to test * feat: reformat code * feat: reformat code * Updates to make config truncate more generic * Improvements and bug fixes * Update galaxy.yml * Added truncate config to update playbook * Fixed indentation error * feat: prune harvested configs * Updated config truncate to accept a list of key paths * feat: better format for yaml files * fix: README.md typos * feat: now compare weights at the same hierarchy level * feat: now compare weights at the same hierarchy level * Added openconfig-acl interfaces to truncate --------- Co-authored-by: Jason King <[email protected]>
- Loading branch information
1 parent
74186a2
commit 6b2460f
Showing
11 changed files
with
122 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from __future__ import absolute_import, division, print_function | ||
|
||
__metaclass__ = type | ||
|
||
from ansible.utils.unsafe_proxy import AnsibleUnsafeText | ||
import yaml | ||
|
||
|
||
class MyDumper(yaml.Dumper): | ||
def increase_indent(self, flow=False, indentless=False): | ||
return super(MyDumper, self).increase_indent(flow, False) | ||
|
||
|
||
def convert_ansible_unsafe_text_to_safe(data): | ||
if isinstance(data, dict): | ||
return {convert_ansible_unsafe_text_to_safe(k): convert_ansible_unsafe_text_to_safe(v) for k, v in data.items()} | ||
elif isinstance(data, list): | ||
return [convert_ansible_unsafe_text_to_safe(item) for item in data] | ||
elif isinstance(data, AnsibleUnsafeText): | ||
return str(data) | ||
else: | ||
return data | ||
|
||
|
||
def to_even_nicer_yaml(config_data): | ||
ansible_safe_config_data = convert_ansible_unsafe_text_to_safe(config_data) | ||
return yaml.dump(ansible_safe_config_data, Dumper=MyDumper, default_flow_style=False, explicit_start=True, | ||
sort_keys=False) | ||
|
||
|
||
class FilterModule(object): | ||
|
||
def filters(self): | ||
return { | ||
'to_even_nicer_yaml': to_even_nicer_yaml | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters