Skip to content

Commit

Permalink
Fix for junos where first line of config includes "## Last commit "
Browse files Browse the repository at this point in the history
comment that make config hash diff, even if the config change was only
in unmanaged parts of the config
  • Loading branch information
indy-independence committed Oct 31, 2024
1 parent 35f44c0 commit 052977d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/cnaas_nms/devicehandler/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ def calc_config_hash(hostname: str, config: str, platform: str, devtype: DeviceT
skip_section = get_config_section(config, section, platform)
if skip_section:
config = config.replace(skip_section, "")
if platform == "junos":
# remove line starting with "## Last commit" from config string so we don't get config hash mismatch
config = re.sub(r"^#{2}.*\n", "", config, flags=re.MULTILINE)
config = config.replace("\n", "")
try:
hash_object = hashlib.sha256(config.encode())
Expand Down

0 comments on commit 052977d

Please sign in to comment.