jaypipes / pcidb

Small golang library for querying PCI database (pciids) information
Apache License 2.0
33 stars 15 forks source link

support PCIDB_CHROOT #10

Closed chiptus closed 5 years ago

chiptus commented 5 years ago

related to https://github.com/jaypipes/ghw/issues/56 and to https://github.com/portainer/agent/issues/34

It seems like the paths in https://github.com/jaypipes/pcidb/blob/master/discover.go#L92-L95 are hardcoded without respecting the GHW_CHROOT and because of that, ghw tries to load pci info from internet. You can add support for the GHW_CHROOT env variable or take hostRoot as an option when calling pcidb.New()

I'll make a PR, let me know what you think

jaypipes commented 5 years ago

Hi! :)

So, since we've now separated pcidb from ghw (it's a wholly-independent lib now), let's go ahead and add support in pcidb for a new PCIDB_CHROOT env variable. As much as possible, I don't want to rely on any env var from ghw in this library.

I'll add more comments to your PR...

chiptus commented 5 years ago

I agree, the problem would be that users of ghw need to know to set this variable, that means they need to know your implementation details.

I would say set the value of PCIDB_CHROOT to be the same as GHW_CHROOT - do this in the ghw library

On Thu, Nov 8, 2018 at 3:40 PM Jay Pipes notifications@github.com wrote:

Hi! :)

So, since we've now separated pcidb from ghw (it's a wholly-independent lib now), let's go ahead and add support in pcidb for a new PCIDB_CHROOT env variable. As much as possible, I don't want to rely on any env var from ghw in this library.

I'll add more comments to your PR...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jaypipes/pcidb/issues/10#issuecomment-436996943, or mute the thread https://github.com/notifications/unsubscribe-auth/ABUVF94-Edv4HOBuiUS8t2vbR1qEsQfYks5utDRVgaJpZM4YUSse .

jaypipes commented 5 years ago

@chiptus once your PR #11 merges with the new PCIDB_CHROOT env var, yes, let's make a change to ghw to automatically set PCIDB_CHROOT to GHW_CHROOT. ++