Commit e2305c86 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

Merge branch 'master' into develop

parents c67cdeff be16936f
......@@ -16,6 +16,9 @@ my $DIR_SRC = getcwd;
my $DIR_DST;
my $DEBIAN = "DEBIAN";
my %COPY_RELEASES = (
'ubuntu-19.04'=> ['ubuntu-18.10','ubuntu-19.10']
);
my %DIR = (
templates => '/usr/share/ravada'
,'etc/ravada.conf' => 'etc'
......@@ -324,6 +327,18 @@ sub get_fallback {
print `etc/get_fallback.pl`;
}
sub copy_identical_releases {
for my $source (sort keys %COPY_RELEASES ) {
for my $copy (@{$COPY_RELEASES{$source}}) {
my $file_source = "$DIR_SRC/../ravada_release/ravada_${VERSION}_${source}_all.deb";
die "Error: No $file_source" if !-e $file_source;
my $file_copy = "$DIR_SRC/../ravada_release/ravada_${VERSION}_${copy}_all.deb";
copy($file_source, $file_copy) or die "Error: $!\n$file_source -> $file_copy";
}
}
exit;
}
#########################################################################
get_fallback();
......@@ -367,3 +382,5 @@ tar($dist);
create_md5sums();
create_deb($dist);
}
copy_identical_releases();
......@@ -4,7 +4,7 @@ Architecture: all
Section: utils
Priority: optional
Maintainer: Francesc Guasch <frankie@telecos.upc.edu>
Depends: perl (>=5.18),libmojolicious-perl,mysql-common,libauthen-passphrase-perl, libdatetime-perl, libdbd-mysql-perl,libdbi-perl,libdbix-connector-perl,libipc-run3-perl,libio-stringy-perl,libnet-ldap-perl,libproc-pid-file-perl,libvirt-daemon-system,libsys-virt-perl,libxml-libxml-perl,libconfig-yaml-perl,libmoose-perl,libjson-xs-perl,qemu-utils,perlmagick,libmoosex-types-netaddr-ip-perl,libio-interface-perl,libiptables-chainmgr-perl,libnet-dns-perl,wget,liblocale-maketext-lexicon-perl,libmojolicious-plugin-i18n-perl,libdbd-sqlite3-perl, debconf (>= 0.2.26), adduser, libdigest-sha-perl, qemu-kvm, net-tools, libfile-rsync-perl, libnet-ssh2-perl, bridge-utils
Depends: perl (>=5.18),libmojolicious-perl,mysql-common,libauthen-passphrase-perl, libdatetime-perl, libdbd-mysql-perl,libdbi-perl,libdbix-connector-perl,libipc-run3-perl,libio-stringy-perl,libnet-ldap-perl,libproc-pid-file-perl,libvirt-daemon-system,libsys-virt-perl,libxml-libxml-perl,libconfig-yaml-perl,libmoose-perl,libjson-xs-perl,qemu-utils,perlmagick,libmoosex-types-netaddr-ip-perl,libio-interface-perl,libiptables-chainmgr-perl,libnet-dns-perl,wget,liblocale-maketext-lexicon-perl,libmojolicious-plugin-i18n-perl,libdbd-sqlite3-perl, debconf (>= 0.2.26), adduser, libdigest-sha-perl, qemu-kvm, net-tools, libfile-rsync-perl, libnet-ssh2-perl, bridge-utils, libencode-locale-perl
Description: Remote Virtual Desktops Manager
Ravada is a software that allows the user to connect to a
remote virtual desktop.
......@@ -4,7 +4,7 @@ Architecture: all
Section: utils
Priority: optional
Maintainer: Francesc Guasch <frankie@telecos.upc.edu>
Depends: perl (>=5.18),libmojolicious-perl,mysql-common,libauthen-passphrase-perl, libdatetime-perl, libdbd-mysql-perl,libdbi-perl,libdbix-connector-perl,libipc-run3-perl,libio-stringy-perl,libnet-ldap-perl,libproc-pid-file-perl,libvirt-bin,libvirt-daemon-system,libsys-virt-perl,libxml-libxml-perl,libconfig-yaml-perl,libmoose-perl,libjson-xs-perl,qemu-utils,perlmagick,libmoosex-types-netaddr-ip-perl,libio-interface-perl,libiptables-chainmgr-perl,libnet-dns-perl,wget,liblocale-maketext-lexicon-perl,libmojolicious-plugin-i18n-perl,libdbd-sqlite3-perl, debconf (>= 0.2.26), adduser, libdigest-sha-perl, qemu-kvm, net-tools, libfile-rsync-perl, libnet-ssh2-perl, bridge-utils
Depends: perl (>=5.18),libmojolicious-perl,mysql-common,libauthen-passphrase-perl, libdatetime-perl, libdbd-mysql-perl,libdbi-perl,libdbix-connector-perl,libipc-run3-perl,libio-stringy-perl,libnet-ldap-perl,libproc-pid-file-perl,libvirt-bin,libvirt-daemon-system,libsys-virt-perl,libxml-libxml-perl,libconfig-yaml-perl,libmoose-perl,libjson-xs-perl,qemu-utils,perlmagick,libmoosex-types-netaddr-ip-perl,libio-interface-perl,libiptables-chainmgr-perl,libnet-dns-perl,wget,liblocale-maketext-lexicon-perl,libmojolicious-plugin-i18n-perl,libdbd-sqlite3-perl, debconf (>= 0.2.26), adduser, libdigest-sha-perl, qemu-kvm, net-tools, libfile-rsync-perl, libnet-ssh2-perl, bridge-utils, libencode-locale-perl
Description: Remote Virtual Desktops Manager
Ravada is a software that allows the user to connect to a
remote virtual desktop.
control-ubuntu-19.04
\ No newline at end of file
......@@ -3,7 +3,7 @@ package Ravada;
use warnings;
use strict;
our $VERSION = '0.5.0-rc8';
our $VERSION = '0.5.0-rc9';
use Carp qw(carp croak);
use Data::Dumper;
......@@ -2388,7 +2388,6 @@ sub _do_execute_command {
if ($err) {
my $user = $request->defined_arg('user');
if ($user) {
warn "sending message to ".$user->id." ".$user->name;
my $subject = $err;
my $message = '';
if (length($subject) > 40 ) {
......
......@@ -1487,6 +1487,7 @@ sub _after_remove_domain {
$self->_finish_requests_db();
$self->_remove_base_db();
$self->_remove_access_attributes_db();
$self->_remove_ports_db();
$self->_remove_volumes_db();
$self->_remove_bases_vm_db();
$self->_remove_domain_db();
......@@ -1517,6 +1518,14 @@ sub _remove_domain_cascade($self,$user, $cascade = 1) {
}
}
sub _remove_ports_db($self) {
return if !$self->{_data}->{id};
my $sth = $$CONNECTOR->dbh->prepare("DELETE FROM domain_ports"
." WHERE id_domain=?");
$sth->execute($self->id);
$sth->finish;
}
sub _remove_access_attributes_db($self) {
return if !$self->{_data}->{id};
......@@ -2290,14 +2299,21 @@ sub _add_expose($self, $internal_port, $name, $restricted) {
." VALUES (?,?,?,?,?)"
);
my $public_port = $self->_vm->_new_free_port();
$sth->execute($self->id
, $public_port, $internal_port
, ($name or undef)
, $restricted
);
$sth->finish;
my $public_port;
for (;;) {
eval {
$public_port = $self->_vm->_new_free_port();
$sth->execute($self->id
, $public_port, $internal_port
, ($name or undef)
, $restricted
);
$sth->finish;
};
last if !$@;
confess $@ if $@ && $@ !~ /Duplicate entry .*for key 'public/;
}
$self->_open_exposed_port($internal_port, $name, $restricted)
if $self->is_active && $self->ip;
......
......@@ -7,7 +7,6 @@ use Encode::Locale;
use Fcntl qw(:flock O_WRONLY O_EXCL O_CREAT);
use Hash::Util qw(lock_hash);
use IPC::Run3 qw(run3);
use LWP::UserAgent;
use Moose;
use Socket qw( inet_aton inet_ntoa );
use Sys::Hostname;
......
......@@ -49,6 +49,9 @@ sub test_remove_domain {
my $vm_name = shift;
my $domain = test_create_domain($vm_name);
my $id_domain = $domain->id;
$domain->expose(22);
is(scalar($domain->list_ports), 1);
my @volumes = $domain->list_volumes();
$domain->remove($USER);
......@@ -63,6 +66,18 @@ sub test_remove_domain {
ok(!-e $vol,"[$vm_name] volume $vol should be removed");
}
}
test_ports_remove($id_domain);
}
sub test_ports_remove {
my $id_domain = shift;
my $sth = connector->dbh->prepare(
"SELECT count(*) FROM domain_ports "
." WHERE id_domain = ? "
);
my ($count) = $sth->fetchrow;
is($count,undef);
}
sub test_remove_domain_base {
......
......@@ -497,6 +497,38 @@ sub test_clone_exports($vm) {
$base->remove(user_admin);
}
sub test_clone_exports_add_ports($vm) {
my $base = create_domain($vm, user_admin,'debian stretch');
$base->expose(port => 22, name => "ssh");
my @base_ports0 = $base->list_ports();
$base->prepare_base(user => user_admin, with_cd => 1);
my $clone = $base->clone(name => new_domain_name, user => user_admin);
$base->expose(port => 80, name => "web");
my @base_ports = $base->list_ports();
is(scalar @base_ports, scalar @base_ports0 + 1);
$clone->start(remote_ip => '10.1.1.1', user => user_admin);
my @clone_ports = $clone->list_ports();
is(scalar @clone_ports,2 );
for my $n ( 0 .. 1 ) {
is($base_ports[$n]->{internal_port}, $clone_ports[$n]->{internal_port});
isnt($base_ports[$n]->{public_port}, $clone_ports[$n]->{public_port},"Same public port in clone and base for ".$base_ports[$n]->{internal_port});
is($base_ports[$n]->{name}, $clone_ports[$n]->{name});
}
_wait_ip($vm, $clone);
wait_request( );
my @out = split /\n/, `iptables -t nat -L PREROUTING -n`;
ok(grep /dpt:\d+.*\d+:22/, @out);
ok(grep /dpt:\d+.*\d+:80/, @out);
$clone->remove(user_admin);
$base->remove(user_admin);
}
sub _wait_ip {
my $vm_name = shift;
my $domain = shift or confess "Missing domain arg";
......@@ -898,6 +930,7 @@ for my $vm_name ( 'KVM', 'Void' ) {
next if !$vm;
diag("Testing $vm_name");
test_clone_exports_add_ports($vm);
test_no_dupe($vm);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment