Skip to content

Commit

Permalink
fixes issue with warning message for previous commit #357
Browse files Browse the repository at this point in the history
  • Loading branch information
bb-Ricardo committed Dec 22, 2023
1 parent cad23c5 commit ad64f3a
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions module/sources/common/source_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,18 +405,16 @@ def add_update_interface(self, interface_object, device_object, interface_data,
# * both are part of the same vrf
current_vrf = grab(ip, "data.vrf")
if possible_ip_vrf != current_vrf:
if not isinstance(possible_ip_vrf, NetBoxObject):
possible_ip_vrf = str(possible_ip_vrf)
else:
possible_ip_vrf = possible_ip_vrf.get_display_name()
if not isinstance(current_vrf, NetBoxObject):
current_vrf = str(current_vrf)
else:
current_vrf = current_vrf.get_display_name()

log.warning(f"Possibly wrongly assigned VRF for {current_ip_nic.get_display_name()} IP "
f"'{ip_address_string}'. Current VRF '{current_vrf}' and "
f"possible VRF '{possible_ip_vrf}'")
possible_ip_vrf_str = possible_ip_vrf if not isinstance(possible_ip_vrf, NetBoxObject) \
else possible_ip_vrf.get_display_name()
current_vrf_str = current_vrf if not isinstance(current_vrf, NetBoxObject) \
else current_vrf.get_display_name()
current_ip_nic_str = "" if not isinstance(current_ip_nic, NetBoxObject) else \
" "+current_ip_nic.get_display_name()

log.warning(f"Possibly wrongly assigned VRF for{current_ip_nic_str} IP "
f"'{ip_address_string}'. Current VRF '{current_vrf_str}' and "
f"possible VRF '{possible_ip_vrf_str}'")
continue

# IP address is not assigned to any interface
Expand Down

0 comments on commit ad64f3a

Please sign in to comment.