more work
This commit is contained in:
parent
c4810cb11a
commit
c1ac43627a
|
@ -0,0 +1,41 @@
|
|||
#
|
||||
# (c) Zane C. Bowers-Hadley <vvelox@vvelox.net>
|
||||
#
|
||||
|
||||
package Rex::Virtualization::CBSD::info;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our $VERSION = '0.0.1'; # VERSION
|
||||
|
||||
use Rex::Logger;
|
||||
use Rex::Helper::Run;
|
||||
use Term::ANSIColor qw(colorstrip);
|
||||
|
||||
sub execute {
|
||||
my ( $class, $name ) = @_;
|
||||
|
||||
if (!defined( $name ) ){
|
||||
die('No VM name defined');
|
||||
}
|
||||
|
||||
Rex::Logger::debug("CBSD VM info via cbsd bget jname=".$name);
|
||||
|
||||
#
|
||||
my $returned=i_run ('cbsd bget jname='.$name , fail_ok => 1);
|
||||
# the output is colorized, if there is an error
|
||||
$returned=colorstrip($returned);
|
||||
if ( $returned =~ /^No\ such/ ){
|
||||
die('"'.$name.'" does not exist');
|
||||
}
|
||||
# check for this second as no VM will also exit non-zero
|
||||
if ( $? != 0 ) {
|
||||
die("Error running 'cbsd bget jname=".$name."'");
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
1;
|
|
@ -33,6 +33,7 @@ sub execute {
|
|||
# the output is colorized
|
||||
$returned=colorstrip($returned);
|
||||
|
||||
# as of CBSD 12.1.7, it won't exit non-zero for this, so check here
|
||||
if ( $returned =~ /^No\ such/ ){
|
||||
die('"'.$name.'" does not exist');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue