From: Dominik Csapak Date: Tue, 6 Mar 2018 10:08:04 +0000 (+0100) Subject: seperate serachdomain and nameserver config X-Git-Url: https://git.proxmox.com/?p=pve-container.git;a=commitdiff_plain;h=ffc468ee431411804bdbf2aae96b80942cb20760 seperate serachdomain and nameserver config until now, if either searchdomain or nameservers was not set, we used the values from the host. it would make sense, to set this individually (e.g. only use a different searchdomain) Signed-off-by: Dominik Csapak --- diff --git a/src/PVE/LXC/Setup/Base.pm b/src/PVE/LXC/Setup/Base.pm index 0228fe7..62e37b9 100644 --- a/src/PVE/LXC/Setup/Base.pm +++ b/src/PVE/LXC/Setup/Base.pm @@ -28,27 +28,24 @@ sub lookup_dns_conf { my $nameserver = $conf->{nameserver}; my $searchdomains = $conf->{searchdomain}; - if (!($nameserver && $searchdomains)) { - - if ($conf->{'testmode'}) { - - $nameserver = "8.8.8.8 8.8.8.9"; - $searchdomains = "proxmox.com"; - - } else { - - my $host_resolv_conf = $self->{host_resolv_conf}; + if ($conf->{'testmode'}) { + return ('proxmox.com', '8.8.8.8 8.8.8.9'); + } - $searchdomains = $host_resolv_conf->{search}; + my $host_resolv_conf = $self->{host_resolv_conf}; - my @list = (); - foreach my $k ("dns1", "dns2", "dns3") { - if (my $ns = $host_resolv_conf->{$k}) { - push @list, $ns; - } + if (!defined($nameserver)) { + my @list = (); + foreach my $k ("dns1", "dns2", "dns3") { + if (my $ns = $host_resolv_conf->{$k}) { + push @list, $ns; } - $nameserver = join(' ', @list); } + $nameserver = join(' ', @list); + } + + if (!defined($searchdomains)) { + $searchdomains = $host_resolv_conf->{search}; } return ($searchdomains, $nameserver);