-
Notifications
You must be signed in to change notification settings - Fork 16
(FACT-1716) Add metadata to detector output #3
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
Conversation
Magisus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Over all this looks good. Have you been able to test it working in a real environment? If so, out of curiosity, how have you been setting those up?
lib/src/sources/dmi_source.cc
Outdated
| LOG_DEBUG("dmidecode executable not found"); | ||
| } else { | ||
| int dmi_type {-1}; | ||
| int dmi_type{-1}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure curly brace initialization usually has the space that was deleted here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm noticing those spaces are missing throughout. Is that intentional? (I'm happy to be corrected)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just wasn't really aware of what the standard way to do it was - I will adjust to include the space!
| case 0: { // BIOS information | ||
| if (index == 0) { | ||
| member = &data_->bios_vendor; | ||
| data_->bios_vendor = move(value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the way you've refactored this switch :)
|
@Magisus So far I've just been testing on local Linux and Windows VMs inside of VirtualBox or VMware - those cases look fine (usually I just write the tests first without fixtures, run them on the system I'm testing and then modify them once it seems to work). That process will stop being very useful pretty soon - it'd be great to talk with the team at some point about how to do it better. |
|
Awesome, thanks. And yeah we might have to get creative in some cases. I kind of like the idea though, will give us more insight into the kinds of deployments customers actually use. |
Adds a vector of OEM strings to the collected data from the DMI source. This information is not available in the /sys/class/dmi/id/ directory, so it can only be collected with root privileges via dmidecode (or the DMI table). Not all vendors store useful information in the OEM strings, but VirtualBox, for example, reports the hypervisor version and revision there. Also refactors DMI tests so that a single fixture class can use fixtures for files in /sys/class/dmi/id/ and dmidecode output simultaneously.
Introduces two new entities: - A metadata object wrapping a map of keys (strings) to values (strings or bools, currently) - A result object to replace the boolean return type of detectors. A result reports whether a hypervisor was detected and contains a metadata object with any other hypervisor information gleaned by the detector. Changes the return type of the main `hypervisors()` function from a vector of hyperivsor name strings to a vector of result objects. Updates the VirtualBox detector to include version and revision metadata.
First commit (preparation for second commit)
Adds a vector of OEM strings to the collected data from the DMI source. This information is not available in the /sys/class/dmi/id/ directory, so it can only be collected with root privileges via dmidecode (or the DMI table).
Not all vendors store useful information in the OEM strings, but VirtualBox, for example, reports the hypervisor version and revision there.
Also refactors DMI tests so that a single fixture class can use fixtures for files in
/sys/class/dmi/id/anddmidecodeoutput simultaneously.Second commit
Introduces two new entities:
Changes the return type of the main
hypervisors()function from a vector of hypervisor name strings to a vector of result objects. Updates the VirtualBox detector to include version and revision metadata.