kellyjonbrazil / jc

CLI tool and python library that converts the output of popular command-line tools, file-types, and common strings to JSON, YAML, or Dictionaries. This allows piping of output to tools like jq and simplifying automation scripts.
MIT License
7.82k stars 202 forks source link

`lspci` parser PhySlot issue #554

Closed wwitzel3 closed 3 months ago

wwitzel3 commented 6 months ago

My system has some output from lspci that is as follows:

Slot:   38:00.0
Class:  PCI bridge [0604]
Vendor: Broadcom / LSI [1000]
Device: PEX890xx PCIe Gen 5 Switch [c030]
PhySlot:        255-2
Rev:    b0
NUMANode:       0
IOMMUGroup:     43

This PhySlot fails to parse with jc because of the attempt to cast 255-2 to an integer.

https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/lspci.py#L162

wwitzel3 commented 6 months ago

The work around for now is to use raw=True to avoid going through the step of transforming the data to the types defined in the schema.

kellyjonbrazil commented 6 months ago

Thank you for reporting this! I didn't realize that field would be a non-integer value. Sounds like I should just keep that a string field. (no integer conversion)

kellyjonbrazil commented 5 months ago

This is fixed in the dev branch. This will make it into the next release.

https://github.com/kellyjonbrazil/jc/blob/dev/jc/parsers/lspci.py

You can test by copying the parser file above into your parser plugin folder:

kellyjonbrazil commented 3 months ago

Fixed in v1.25.3