Skip to content

Commit

Permalink
Merge branch 'main' into fix/2036_add_video_none
Browse files Browse the repository at this point in the history
  • Loading branch information
frankiejol authored May 3, 2024
2 parents 8310b73 + c23d577 commit ebfd577
Show file tree
Hide file tree
Showing 61 changed files with 2,877 additions and 416 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/github-action-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ jobs:
- uses: actions/checkout@v2
- name: tmpfs run user
run: sudo mkdir -p /run/user/$(id -u) ; sudo chown $(id -u) /run/user/$(id -u)
- uses: mirromutth/mysql[email protected]
- uses: getong/mariadb[email protected]
with:
character set server: 'utf8' # Optional, default value is 'utf8mb4'. The '--character-set-server' option for mysqld
collation server: 'utf8_general_ci' # Optional, default value is 'utf8mb4_general_ci'. The '--collation-server' option for mysqld
mariadb version: '10.4.10' # Optional, default value is "latest". The version of the MariaDB
mysql database: 'ravada' # Optional, default value is "test". The specified database which will be create
mysql root password: root
mysql user: 'rvd_user' # Required if "mysql root password" is empty, default is empty. The superuser for the specified database. Can use secrets, too
mysql password: Pword12345*
mysql user: 'rvd_user'
mysql password: 'Pword12345*'
- name: Update packages
run: sudo apt update
- name: Install auth packages
Expand All @@ -34,10 +34,6 @@ jobs:
run: cat /etc/ravada.conf
- name: Install mysql perl
run: sudo apt install libdbd-mysql-perl libhtml-lint-perl
- name: create mysql user
run: sudo mysql -u root --password=root --protocol=tcp -h localhost -e "create user 'rvd_user'@'%' IDENTIFIED WITH mysql_native_password BY 'Pword12345*'"
- name: allow mysql user
run: sudo mysql -u root --password=root --protocol=tcp -h localhost -e "grant all on ravada.* to 'rvd_user'@'%'"
- name: Test mojo grants
run: prove -l t/mojo/30_grants.t
- name: Test critic
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@

**Bugfixes**

- Node Option Not Available [\#2032]

**Refactors**
2 changes: 1 addition & 1 deletion MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ lib/Ravada/I18N/ca.po
lib/Ravada/NetInterface.pm
lib/Ravada/Auth.pm
lib/Ravada/Domain.pm
lib/Ravada/Routes.pm
lib/Ravada/Route.pm
script/rvd_front
script/rvd_back
27 changes: 27 additions & 0 deletions deb/debianize.pl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

use Carp qw(confess);
use Cwd qw(getcwd);
use Data::Dumper;
use File::Path qw(remove_tree make_path);
use IPC::Run3;
use lib './lib';
Expand Down Expand Up @@ -93,6 +94,32 @@ sub remove_not_needed {
die "Missing $path" if ! -e $path;
remove_tree($path);
}
remove_custom_files("public/js/custom");
}

sub remove_custom_files {
my $dir = shift;
opendir my $ls,$dir or die "$! $dir";
while ( my $file = readdir $ls) {
next if $file =~ m/^\.+$/;
my $path = "$dir/$file";
if ( -d $path ) {
die "Error: no dirs should be in $dir";
} elsif ( -f $path ) {
if ($file !~ /insert_here/) {
my ($dir_dst, $component) = $dir =~ m{(.*)/(.*)};
die "Unknown dir $dir " if !exists $DIR{$dir_dst};
my $deb_path = "$DIR_DST/$DIR{$dir_dst}/$component/$file";
if (! -e $deb_path ) {
($component) = $dir =~ m{.*/(\w+/\w+)};
$deb_path = "$DIR_DST/$DIR{$dir_dst}/$component/$file";
}
unlink $deb_path or die "$! $deb_path";
}
} else {
warn "Warning: unknown file type $file (neither file nor dir)";
}
}
}

sub create_md5sums {
Expand Down
5 changes: 5 additions & 0 deletions etc/rvd_front.conf.example
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,9 @@
,file => '/var/log/ravada/rvd_front.log'
,level => 'debug'
}
,status => {
allowed => [
'127.0.0.1'
]
}
};
98 changes: 75 additions & 23 deletions lib/Ravada.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package Ravada;
use warnings;
use strict;

our $VERSION = '2.2.0';
our $VERSION = '2.2.1';

use utf8;

Expand Down Expand Up @@ -463,19 +463,7 @@ sub _update_isos {
,arch => 'x86_64'
}

,serena64 => {
name => 'Mint 18.1 Mate 64 bits'
,description => 'Mint Serena 18.1 with Mate Desktop based on Ubuntu Xenial 64 bits'
,arch => 'x86_64'
,xml => 'xenial64-amd64.xml'
,xml_volume => 'xenial64-volume.xml'
,url => 'https://mirrors.edge.kernel.org/linuxmint/stable/18.3'
,file_re => 'linuxmint-18.3-mate-64bit.iso'
,md5_url => ''
,md5 => 'c5cf5c5d568e2dfeaf705cfa82996d93'
,min_disk_size => '10'

}

,mint20_64 => {
name => 'Mint 20 Mate 64 bits'
,description => 'Mint Ulyana 20 with Mate Desktop 64 bits'
Expand Down Expand Up @@ -1477,6 +1465,8 @@ sub _remove_old_isos {

,"DELETE FROM iso_images "
." WHERE name like 'Alpine%3.8%'"
,"DELETE FROM iso_images "
." WHERE name like 'Mint 18.1 Mate 64 bits'"
) {
my $sth = $CONNECTOR->dbh->prepare($sql);
$sth->execute();
Expand Down Expand Up @@ -1567,8 +1557,9 @@ sub _add_indexes_generic($self) {
"unique (id_domain)"
]
,group_access => [
"unique (id_domain,name)"
"unique (id_domain,name,id_group)"
,"index(id_domain)"
,"index(id_group)"
]
,iso_images => [
"unique (name)"
Expand Down Expand Up @@ -1619,6 +1610,11 @@ sub _add_indexes_generic($self) {
"index(id_booking_entry,ldap_group)"
,"index(id_booking_entry)"
]
,booking_entry_local_groups => [
"unique(id_booking_entry,id_group)"
,"index(id_booking_entry)"
]

,booking_entry_users => [
"index(id_booking_entry,id_user)"
,"index(id_booking_entry)"
Expand All @@ -1629,6 +1625,12 @@ sub _add_indexes_generic($self) {
,"index(id_base)"
,"index(id_booking_entry)"
]
,groups_local => [
'UNIQUE (name)'
]
,users_group => [
'UNIQUE(id_user, id_group)'
]

,volumes => [
"index(id_domain)"
Expand Down Expand Up @@ -2212,11 +2214,21 @@ sub _sql_create_tables($self) {
,xml => 'TEXT'
}
]
,
[ groups_local => {
id => 'integer PRIMARY KEY AUTO_INCREMENT',
,name => 'char(255) NOT NULL'
,is_external => 'int NOT NULL default(0)'
,external_auth => 'varchar(64) default NULL'
}
]
,[
group_access => {
id => 'integer NOT NULL PRIMARY KEY AUTO_INCREMENT'
,id_domain => 'integer NOT NULL references `domains` (`id`) ON DELETE CASCADE'
,name => 'char(80)'
,id_group => 'integer references `groups_local` (`id`) ON DELETE CASCADE'
,name => 'char(80) DEFAULT NULL'
,type => 'char(40)'
}
]
,
Expand Down Expand Up @@ -2348,6 +2360,17 @@ sub _sql_create_tables($self) {
}
]
,
[
booking_entry_local_groups => {
id => 'INTEGER PRIMARY KEY AUTO_INCREMENT'
,id_booking_entry
=> 'int not null references `booking_entries` (`id`) ON DELETE CASCADE'
,id_group => 'int not null'
,date_changed => 'timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'
}
]
,

[
booking_entry_users => {
id => 'INTEGER PRIMARY KEY AUTO_INCREMENT'
Expand Down Expand Up @@ -2377,6 +2400,12 @@ sub _sql_create_tables($self) {
}
]
,
[ users_group => {
id => 'integer PRIMARY KEY AUTO_INCREMENT',
,id_user => 'integer NOT NULL'
,id_group =>'integer NOT NULL'
}
],
[
volumes => {
id => 'integer PRIMARY KEY AUTO_INCREMENT',
Expand Down Expand Up @@ -2670,7 +2699,7 @@ sub _sql_insert_defaults($self){
,{
id_parent => $id_backend
,name => 'bookings'
,value => 0
,value => 1
}
,{
id_parent => $id_backend
Expand Down Expand Up @@ -2713,6 +2742,17 @@ sub _sql_insert_defaults($self){
,name => 'time'
,value => '21:00'
}
,{
id_parent => '/backend'
,name => 'limits'
,value => undef
}
,{
id_parent => '/backend/limits'
,name => 'startup_ram'
,value => 1
}


]
);
Expand Down Expand Up @@ -2840,6 +2880,7 @@ sub _upgrade_tables {
$self->_upgrade_table('vms', 'clone_storage','varchar(64) DEFAULT NULL');
$self->_upgrade_table('vms','dir_backup','varchar(128) DEFAULT NULL');
$self->_upgrade_table('vms','version','varchar(64) DEFAULT NULL');
$self->_upgrade_table('vms','cached_down','int DEFAULT 0');

$self->_upgrade_table('requests','at_time','int(11) DEFAULT NULL');
$self->_upgrade_table('requests','pid','int(11) DEFAULT NULL');
Expand Down Expand Up @@ -2999,7 +3040,7 @@ sub _connect_dbh($self=undef) {

return $con if $con && !$err;
sleep 1;
warn "Try $try $@\n";
warn "Try $try $data_source $@\n";
}
die ($@ or "Can't connect to $driver $db at $host");
}
Expand Down Expand Up @@ -4389,6 +4430,8 @@ sub _cmd_manage_pools($self, $request) {
sub _cmd_discover($self, $request) {
my $id_vm = $request->args('id_vm');
my $vm = Ravada::VM->open($id_vm);
return if !$vm;
eval { return if !$vm->vm };
my @list = $vm->discover();
$request->output(encode_json(\@list));
}
Expand Down Expand Up @@ -5570,7 +5613,7 @@ sub _check_mounted($path, $fstab, $mtab) {
sub _cmd_check_storage($self, $request) {
my $contents = "a" x 160;
for my $vm ( $self->list_vms ) {
next if !$vm->is_local;
next if !$vm || !$vm->is_local;
my %fstab = _list_mnt($vm,"s");
my %mtab = _list_mnt($vm,"m");

Expand Down Expand Up @@ -5684,8 +5727,11 @@ sub _cmd_shutdown_node($self, $request) {

sub _cmd_start_node($self, $request) {
my $id_node = $request->args('id_node');
my $node = Ravada::VM->open($id_node);
$node->start();
my $node;
eval{ $node = Ravada::VM->open($id_node);
$node->start() if$node;
};
Ravada::VM::_wake_on_lan($id_node) if !$node;
}

sub _cmd_connect_node($self, $request) {
Expand Down Expand Up @@ -5946,6 +5992,7 @@ sub _refresh_active_vms ($self) {

my %active_vm;
for my $vm ($self->list_vms) {
next if !$vm;
if ( !$vm->enabled() || !$vm->is_active ) {
$vm->shutdown_domains();
$active_vm{$vm->id} = 0;
Expand Down Expand Up @@ -6505,7 +6552,10 @@ sub search_vm {
);
$sth->execute($type, $host);
my ($id) = $sth->fetchrow();
return Ravada::VM->open($id) if $id;
my $vm;
$vm = Ravada::VM->open($id) if $id;
return if $host eq 'localhost' && $vm && !$vm->vm;

return if $host ne 'localhost';

my $vms = $self->_create_vm($type);
Expand Down Expand Up @@ -6537,7 +6587,9 @@ sub vm($self) {
warn $@;
next;
}
push @vms, ( $vm );
eval {
push @vms, ( $vm ) if $vm && $vm->vm;
};
};
return [@vms] if @vms;
return $self->_create_vm();
Expand Down
Loading

0 comments on commit ebfd577

Please sign in to comment.