The Perl Toolchain Summit 2025 Needs You: You can help 🙏 Learn more

#
# (c) Jan Gehring <jan.gehring@gmail.com>
#
use v5.12.5;
our $VERSION = '1.15.0.2'; # TRIAL VERSION
sub execute {
my ( $class, $vmname ) = @_;
unless ($vmname) {
die("You have to define the vm name!");
}
Rex::Logger::debug("Getting info of domain: $vmname");
my $xml;
my @dominfo = i_run "VBoxManage showvminfo \"$vmname\" --machinereadable",
fail_ok => 1;
if ( $? != 0 ) {
die("Error running VBoxManage showvminfo $vmname");
}
my %ret = ();
my ( $k, $v );
for my $line (@dominfo) {
( $k, $v ) = split( /=/, $line );
$k =~ s/^"|"$//g;
$v =~ s/^"|"$//g;
$ret{$k} = $v;
}
return \%ret;
}
1;