1# 2# (c) Jan Gehring <jan.gehring@gmail.com> 3# 4# vim: set ts=2 sw=2 tw=0: 5# vim: set expandtab: 6 7package Rex::Virtualization::VBox::status; 8 9use 5.010001; 10use strict; 11use warnings; 12 13our $VERSION = '1.13.4'; # VERSION 14 15use Rex::Virtualization::VBox::list; 16 17sub execute { 18 my ( $class, $arg1, %opt ) = @_; 19 20 my $vms = Rex::Virtualization::VBox::list->execute("all"); 21 22 my ($vm) = grep { $_->{name} eq $arg1 } @{$vms}; 23 24 if ( $vm->{status} eq "poweroff" ) { 25 return "stopped"; 26 } 27 else { 28 return "running"; 29 } 30} 31 321; 33