our
$VERSION
=
'0.0.1'
;
sub
execute {
my
(
$class
) =
@_
;
my
$command
=
'cbsd bsnapshot mode=list display=jname,snapname,creation,refer header=0'
;
Rex::Logger::debug(
"Listing VM disk snapshots for CBSD via... "
.
$command
);
my
$returned
= i_run(
$command
,
fail_ok
=> 1 );
$returned
= colorstrip(
$returned
);
if
( $? != 0 ) {
die
(
"Error running '"
.
$command
.
"'"
);
}
my
@snapshots
;
my
@returned_split
=
split
(/\n/,
$returned
);
foreach
my
$line
(
@returned_split
) {
my
%snap
;
(
$snap
{vm},
$snap
{name},
$snap
{creation},
$snap
{refer} )=
split
(/[\t\ ]+/,
$line
, 4);
push
(
@snapshots
, \
%snap
);
}
return
@snapshots
;
}
1;