Rex icon indicating copy to clipboard operation
Rex copied to clipboard

Rex::Hardware::VirtInfo does not handle stuff properly outside of Linux

Open VVelox opened this issue 2 years ago • 0 comments

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

VVelox avatar Aug 07 '23 01:08 VVelox