Rex::Hardware::VirtInfo does not handle stuff properly outside of Linux
Nobody has claimed this yet.
- Dominant language
- Perl
- Stars
- 737
- Forks
- 214
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
Rex::Hardware::VirtInfo assumes that it is being ran on Linux and does not properly use Rex::Inventory::Bios::get, which is the proper cross platform manner to the non kernel module info this module uses.
That said Rex::Inventory::Bios::get does not work as non-root so grabbing when it can via the relevent items under /sys on Linux works.
See https://github.com/RexOps/Rex/pull/1599/files for a fix for this.
Similarly $modules is fetched in a Linux specific manner. Should be /sbin/kldstat on FreeBSD.
The module check for kvm should only work on Linux.
Expected behavior
Works in a cross platform manner via dmidecode via Rex::Inventory::Bios::get.
How to reproduce it
Using on something other than Linux such as FreeBSD.
Code example
use Rex; use Rex::Commands::Gather; dump_system_information;
Additional context
No response
Rex version
1.14.2
Perl version
5.32.1
Operating system running rex
FreeBSD
Operating system managed by rex
FreeBSD and Linux
How rex was installed?
package manager
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in Rex::Hardware::VirtInfo and compare its Linux-specific handling with Rex::Inventory::Bios::get and the referenced pull request 1599. Check the module and module-list behavior on Linux and FreeBSD, including /sbin/kldstat and the Linux-only kvm check. Done means dump_system_information works correctly on both operating systems without requiring root for available /sys data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- perl
- Domain
- devops, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100