]> git.proxmox.com Git - pve-container.git/commitdiff
seperate serachdomain and nameserver config
authorDominik Csapak <d.csapak@proxmox.com>
Tue, 6 Mar 2018 10:08:04 +0000 (11:08 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 7 Mar 2018 12:07:35 +0000 (13:07 +0100)
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 <d.csapak@proxmox.com>
src/PVE/LXC/Setup/Base.pm

index 0228fe7655b1d59721503431c1d31a2fafe5a038..62e37b9386c2bf032f9712b096bcd081c110829f 100644 (file)
@@ -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);