Skip to content

Commit 6775e8b

Browse files
committed
Add note in docs
1 parent d27c121 commit 6775e8b

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

docs/colliecting-diffs.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ If you have configs in NetBox DataSource, you can define it, the script instead
4242
!!! note
4343
Only synced DataSources are acceptable
4444

45+
!!! note
46+
Diff replaces sequences of 3 or more empty lines with one empty line
47+
4548
If in your DataSource config names are different from the hostnames of the devices, you can specify config name with Jinja2 template in `Name template` field.
4649
Reference device with `{{ object }}` variable.
4750

netbox_config_diff/compliance/utils.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,9 @@ def __init__(self, choices, *args, **kwargs):
3939

4040

4141
def get_unified_diff(rendered_config: str, actual_config: str, device: str) -> str:
42-
rendered_config = re.sub("\n{3,}", "\n", rendered_config)
43-
actual_config = re.sub("\n{3,}", "\n", actual_config)
4442
diff = unified_diff(
45-
actual_config.splitlines(),
46-
rendered_config.strip().splitlines(),
43+
re.sub("\n{3,}", "\n", actual_config).splitlines(),
44+
re.sub("\n{3,}", "\n", rendered_config).strip().splitlines(),
4745
fromfiledate=device,
4846
tofiledate=device,
4947
lineterm="",

0 commit comments

Comments
 (0)