our
$VERSION
=
'0.0.1'
;
sub
execute {
my
(
$class
,
%opts
) =
@_
;
if
( !
defined
(
$opts
{vm} ) ) {
die
'The required variable "vm" is not set'
;
}
if
(
$opts
{vm} =~ /[\t\ \=\\\/\'\"\n\;\&]/ )
{
die
'The value either for "vm", "'
.
$opts
{vm}
.
'" or "name", "'
.
$opts
{name}
.
'", matched /[\t\ \=\/\\\'\"\n\;\&]/, meaning it is not a valid value'
;
}
my
$command
=
'cbsd bsnapshot mode=destroyall jname='
.
$opts
{vm};
Rex::Logger::debug(
"Removing all snapshots for a CBSD VM via... "
.
$command
);
my
$returned
= i_run(
$command
,
fail_ok
=> 1 );
$returned
= colorstrip(
$returned
);
if
( $? != 0 ) {
die
(
"Error running '"
.
$command
.
"'"
);
}
return
1;
}
1;