Commit 324681b8 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

fixed list domains

Spaces had to be stripped from lxc-ls. That's why
it never matched.
parent a6959a07
......@@ -200,7 +200,7 @@ sub search_domain {
my $import = shift;
for my $vm (@{$self->vm}) {
my $domain = $vm->search_domain($name);
my $domain = $vm->search_domain($name, $import);
return if !$domain;
my $id;
eval { $id = $domain->id };
......
......@@ -27,6 +27,7 @@ sub remove {
my $self = shift;
my $name = $self->name or confess "Missing domain name";
my @cmd = ('lxc-destroy','-n',$name,'-f');
warn @cmd;
my ($in,$out,$err);
run3(\@cmd,\$in,\$out,\$err);
warn $out if $out;
......
......@@ -92,6 +92,9 @@ sub _domain_create_from_template {
return $domain;
}
sub prepare_base {
}
sub _domain_create_from_base {
my $self = shift;
my $name = shift or confess "Missing domain name";
......@@ -111,16 +114,16 @@ sub _domain_create_from_base {
sub search_domain {
my $self = shift;
my $name = shift or confess "Missing domain name";
my $import = shift;
for my $domain_lxc ( $self->_list_domains ) {
next if $domain_lxc ne $name;
my $domain ;
my $id;
eval{ $domain = Ravada::Domain::LXC->new(
domain => $name
domain => $domain_lxc
);
$id = $domain->id() if $domain;
$id = $domain->id() if $domain && !$import;
};
return $domain if $domain && $domain->name eq $name;
......@@ -141,7 +144,13 @@ sub search_domain_by_id {
#warn $out if !$out;
warn $err if $err;
return split /\n/,$out;
my @domains;
for (split /\n/,$out) {
s/^\s+//;
s/\s+$//;
push @domains,($_);
}
return @domains;
}
......
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