Skip to content

Commit

Permalink
misc fixes for create and list
Browse files Browse the repository at this point in the history
  • Loading branch information
VVelox committed Oct 14, 2021
1 parent 419a014 commit 27f50bc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
10 changes: 8 additions & 2 deletions Rex-Virtualization-CBSD/lib/Rex/Virtualization/CBSD.pm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ our $VERSION = '0.0.1';
set virtualization => "CBSD";
use Data::Dumper;
print Dumper vm 'create', name=>'foo',
'vm_os_type'=>'freebsd',
'vm_os_profile'=>'FreeBSD-x64-13.0',
'vm_ram'=>'1g',
'vm_cpus'=>'1',
'imgsize'=>'10g';
=cut

Expand Down Expand Up @@ -207,7 +213,7 @@ The returned array is a hash of hashes. The first level hash is the jname.
nodename - The node name that this is set to run on.
vm - Name of the VM.
name - Name of the VM.
jid - Jail ID/process ID of the VM if running. IF '0' it is not running.
Expand Down
6 changes: 3 additions & 3 deletions Rex-Virtualization-CBSD/lib/Rex/Virtualization/CBSD/create.pm
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ sub execute {

if ( defined( $opts{$key} ) ) {

# make sure it does not contain any tabs, spaces, =, \. /, ', ", or new lines.
if ( $opts{$key} =~ /[\t\ \=\\\/\'\"\n]/ ) {
# make sure it does not contain any tabs, single/double quotes, and new lines
if ( $opts{$key} =~ /[\t\'\"\n]/ ) {
die 'The value "'
. $opts{$key}
. '" for key "'
. $key
. '" matched /[\t\ \=\/\\\'\"\n]/, meaning it is not a valid value';
. '" matched /[\t\'\"\n]/, meaning it is not a valid value';
}

if ( defined( $opts{$key} ) ) {
Expand Down
4 changes: 2 additions & 2 deletions Rex-Virtualization-CBSD/lib/Rex/Virtualization/CBSD/list.pm
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ sub execute {

# needs to be updated if display= is ever changed
(
$VM{'node'}, $VM{'vm'}, $VM{'pid'}, $VM{'ram'}, $VM{'curmem'}, $VM{'cpus'},
$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;
}

return \%VMs;
return %VMs;
}

1;

0 comments on commit 27f50bc

Please sign in to comment.