RexOps / Rex

Rex, the friendly automation framework
https://www.rexify.org
717 stars 223 forks source link

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

Open VVelox opened 1 year ago

VVelox commented 1 year ago

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