Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branch: ExecRegexpMap-bugfix #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Branch: ExecRegexpMap-bugfix #14

wants to merge 1 commit into from

Conversation

jonhammer
Copy link

ExecRegexpMap will not properly parse k,v pairs that have the delim present in the values. E.g., pciBus will never get populated properly in /api/network/interfaces.

e.g.,

$ ethtool -i <intf>
driver: sfc
version: 4.13.1.1034
firmware-version: 6.2.7.1000 rx0 tx0
expansion-rom-version:
bus-info: 0000:02:00.1   <---- this line
supports-statistics: yes
supports-test: yes
supports-eeprom-access: no
supports-register-dump: yes
supports-priv-flags: yes

instead of returning map[bus-info:0000:02:00.1] you get map[bus-info:0000].

It would seem like this would result in the pciBus always being "0000", but at line 100 of interfaces.go, there is a check to see if pciBus starts with "0000:" before populating it (not sure why exactly).

100                                 if strings.HasPrefix(m["bus-info"], "0000:") {
101                                         s4 := m["bus-info"]
102                                         wIntf.PCIBus = &s4
103                                         s5 := fmt.Sprintf("/pci/%v", m["bus-info"])
104                                         wIntf.PCIBusURL = &s5

This caused pciBus to never be populated for any host.

My first time touching Go, so not sure if there is a better way to accomplish this.

…t have the delim present in the v. E.g., pciBus will never get populated properly in /api/network/interfaces
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.

None yet

1 participant