cbsd bls works now :)

This commit is contained in:
Zane C. B-H 2020-04-13 04:18:02 -05:00
parent 5dc80d2ab8
commit 9144dd207b
2 changed files with 8 additions and 9 deletions

View File

@ -18,7 +18,7 @@ my %WriteMakefileArgs = (
},
PREREQ_PM => {
'Term::ANSIColor'=>'0',
'Rex'=>'1.9.0';
'Rex'=>'1.9.0',
},
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
clean => { FILES => 'Rex-Virtualization-CBSD-*' },

View File

@ -11,31 +11,30 @@ our $VERSION = '1.9.0'; # VERSION
use Rex::Logger;
use Rex::Helper::Run;
use Term::ANSIColor;
use Term::ANSIColor qw(colorstrip);
sub execute {
my ( $class, $arg1 ) = @_;
Rex::Logger::debug("Getting CBSD VM list via display=nodename,jname,jid,vm_ram,vm_curmem,vm_cpus,pcpu,vm_os_type,ip4_addr,status,vnc,path");
Rex::Logger::debug("Getting CBSD VM list via cbsd bls display=nodename,jname,jid,vm_ram,vm_curmem,vm_cpus,pcpu,vm_os_type,ip4_addr,status,vnc,path");
my %VMs;
my $found=i_run('display=nodename,jname,jid,vm_ram,vm_curmem,vm_cpus,pcpu,vm_os_type,ip4_addr,status,vnc,path'),
fail_ok => 1;
my $found=i_run ('cbsd bls display=nodename,jname,jid,vm_ram,vm_curmem,vm_cpus,pcpu,vm_os_type,ip4_addr,status,vnc,path' , fail_ok => 1);
if ( $? != 0 ) {
die("Error running 'display=nodename,jname,jid,vm_ram,vm_curmem,vm_cpus,pcpu,vm_os_type,ip4_addr,status,vnc,path'");
die("Error running 'cbsd bls display=nodename,jname,jid,vm_ram,vm_curmem,vm_cpus,pcpu,vm_os_type,ip4_addr,status,vnc,path'");
}
$found=colorstrip($found);
my @found_lines=split(/\n/, $found);
foreach my $line (@found_lines){
foreach my $line (@found_lines) {
my %VM;
( $VM{'node'}, $VM{'name'}, $VM{'pid'}, $VM{'ram'}, $VM{'curmem'},
$VM{'cpus'}, $VM{'pcpu'}, $VM{'os'}, $VM{'ip4'}, $VM{'status'},
$VM{'vnc'}, $VM{'path'} ) = split(/[\ \t]/, $line;
$VMs{$VM{'name'}=\%VM;
$VM{'vnc'}, $VM{'path'} ) = split(/[\ \t]+/, $line);
$VMs{$VM{'name'}}=\%VM;
}
return \%VMs;