| 1 | # | ||||||||||
| 2 | # (c) Jan Gehring <jan.gehring@gmail.com> | ||||||||||
| 3 | # | ||||||||||
| 4 | |||||||||||
| 5 | package Rex::Virtualization::VBox::destroy; | ||||||||||
| 6 | |||||||||||
| 7 | 1 | ▶ | use v5.14.4; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 1 | our $VERSION = '1.16.1'; # VERSION | |||||||||
| 11 | |||||||||||
| 12 | 1 | ▶ | use Rex::Logger; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 1 | ▶ | use Rex::Helper::Run; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | 0 | ▶ | sub execute { | ||||||||
|
Subroutine
execute: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||
| 16 | 0 | my ( $class, $arg1, %opt ) = @_; | |||||||||
| 17 | |||||||||||
| 18 | 0 | ▶ | unless ($arg1) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | 0 | die("You have to define the vm name!"); | |||||||||
| 20 | } | ||||||||||
| 21 | |||||||||||
| 22 | 0 | my $dom = $arg1; | |||||||||
| 23 | 0 | Rex::Logger::debug("destroying domain: $dom"); | |||||||||
| 24 | |||||||||||
| 25 | 0 | ▶ | unless ($dom) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | 0 | die("VM $dom not found."); | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | 0 | i_run "VBoxManage controlvm \"$dom\" poweroff", fail_ok => 1; | |||||||||
| 30 | 0 | ▶ | if ( $? != 0 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | 0 | die("Error destroying vm $dom"); | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | 1 | 1; | |||||||||