Skip to content

Commit

Permalink
Downgrade fatal error to a warning in the case of missing LLDP info
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Keay committed Oct 22, 2024
1 parent 0c296e5 commit 667249d
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@

from understack_workflows.bmc import Bmc
from understack_workflows.interface_normalization import normalize_interface_name
from understack_workflows.helpers import setup_logger

urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
logger = setup_logger(__name__)


@dataclass(frozen=True)
Expand Down Expand Up @@ -65,7 +66,11 @@ def interface_data(bmc: Bmc) -> list[InterfaceInfo]:

def combine_lldp(lldp, interface) -> InterfaceInfo:
name = interface["name"]
lldp_entry = lldp[name]
lldp_entry = lldp.get(name, {})
if not lldp_entry:
logger.info(
f"LLDP info from BMC is missing for {name}, we only have {list(lldp.keys())}"
)
return InterfaceInfo(**interface, **lldp_entry)


Expand Down

0 comments on commit 667249d

Please sign in to comment.