Skip to content

Allow device-only CSV inventories without optional attributes - #22

Open
vinsymoyya wants to merge 1 commit into
google:masterfrom
vinsymoyya:fix/csv-device-only-inventory
Open

vinsymoyya wants to merge 1 commit into
google:masterfrom
vinsymoyya:fix/csv-device-only-inventory

Conversation

@vinsymoyya

Copy link
Copy Markdown

Allow CSV inventories containing only the mandatory device column. After removing that column from the attribute header, the parser indexed the empty header list while checking for optional flags and raised IndexError on the first device row.

Guard the optional-header lookup. Device names now map to valid empty attribute tuples, while ordinary attributes and variable-length flags retain their behavior.

Fixes #21.

Validation on Linux / Python 3.13:

  • Two dedicated regressions fail on current master (f15c05543241e5faa482d0fae0c2244d456091b7); three controls pass.
  • With the fix, all 24 minimal-inventory, CSV-inventory, and base-inventory tests pass.
  • Google-style Pyink checks pass for the new test module and changed source line; git diff --check passes. A whole-file source check also proposes formatting changes outside this patch.
  • No live device/accessor integration was run locally.

@harro

harro commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Thanks for submitting the fix.

We probably don't need a dedicated file for this unittest - can you add it to inventory_csv_test.py instead (maybe after the testParseDevicesFromCsv test)?

Thanks
--harro

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.

Device-only CSV inventory crashes during optional flags check

2 participants