Skip to content

fix: handle missing parsed_lldp in baremetal ports inspection hook - #2287

Merged
RSabounds merged 1 commit into
mainfrom
ammo-1323/fix-parsed-lldp-keyerror
Sep 2, 2026
Merged

fix: handle missing parsed_lldp in baremetal ports inspection hook#2287
RSabounds merged 1 commit into
mainfrom
ammo-1323/fix-parsed-lldp-keyerror

Conversation

@RSabounds

Copy link
Copy Markdown
Contributor

Handle a missing parsed_lldp key in the baremetal ports inspection hook so a node with no host-side LLDP skips gracefully instead of failing inspection.

Problem

InspectHookUpdateBaremetalPorts._parse_plugin_data accessed plugin_data["parsed_lldp"] (and ["all_interfaces"]) with hard key lookups. The parse-lldp hook only populates parsed_lldp when at least one interface reports usable LLDP TLVs. When a node returns no host-side LLDP, the key is absent and inspection fails:

Failed to inspect hardware. Reason: ... Unexpected exception KeyError during
processing for node: <uuid>. Error: 'parsed_lldp'

The __call__ method already handles the empty case (logs "No LLDP data" and returns), but _parse_plugin_data crashed on the missing key before that guard could run.

Change

  • Read parsed_lldp and all_interfaces defensively with .get(...) or {}, so _parse_plugin_data returns an empty list and the existing "No LLDP data" guard handles the node instead of raising KeyError.
  • Add tests for the missing-parsed_lldp and empty-parsed_lldp cases.

Context

A node can legitimately present no host-side LLDP (cabling/timing, a switch port down, or — as seen in the field — an Intel E810 NIC in Safe Mode whose firmware LLDP agent consumes inbound LLDPDUs before the host sees them). The E810 Safe Mode root cause is addressed separately by including the ice DDP in the IPA ramdisk (PUC-2035). This change is the defensive backstop so inspection degrades gracefully rather than crashing when LLDP is genuinely absent.

AMMO-1323

The InspectHookUpdateBaremetalPorts._parse_plugin_data function accessed
plugin_data['parsed_lldp'] (and 'all_interfaces') with hard key lookups.
The parse-lldp hook only populates parsed_lldp when at least one interface
reports usable LLDP TLVs, so a node returning no LLDP data caused a
KeyError that failed inspection:

  Unexpected exception KeyError during processing for node: <uuid>.
  Error: 'parsed_lldp'

Read both keys defensively with .get() so the existing 'No LLDP data'
guard in __call__ handles the node gracefully instead of failing
inspection.

Add tests for the missing and empty parsed_lldp cases.

AMMO-1323
@RSabounds
RSabounds force-pushed the ammo-1323/fix-parsed-lldp-keyerror branch from 4ce5d0b to 18bcd10 Compare September 2, 2026 21:27
@RSabounds
RSabounds added this pull request to the merge queue Sep 2, 2026
Merged via the queue into main with commit 3bc1129 Sep 2, 2026
67 checks passed
@RSabounds
RSabounds deleted the ammo-1323/fix-parsed-lldp-keyerror branch September 2, 2026 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants