Fix duplicate PSU creation when dmidecode reports identical PSUs #401
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Fixes #402
When dmidecode reports multiple power supplies with identical data (common with generic/placeholder values like "Default string"), the agent attempts to create duplicate power ports in Netbox. This causes a 400 error:
Example dmidecode output:
Since all PSUs have empty serial numbers, they all get name="N/A" and identical descriptions, causing Netbox to reject the duplicates.
Solution
Added deduplication logic in power.py:18-64
get_power_supply()method:(serial_number, description, max_power)Changes
seen_psusset to track unique PSU combinationsTesting
With this fix, systems reporting multiple identical PSUs will only create one power port in Netbox instead of failing on duplicate creation.
🤖 Generated with Claude Code