]> git.proxmox.com Git - pve-container.git/commitdiff
fix #1844: check /etc/.pve-ignore.hosts early
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 20 Jul 2018 06:49:21 +0000 (08:49 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 20 Jul 2018 07:00:27 +0000 (09:00 +0200)
Our checks for .pve-ignore.* files happen at write time so
we mostly don't have to think about them within the
functions dealing with them. /etc/hosts is one of the files
we need nowhere except when updating it, and there are some
tools managing it and producing files too large for our
default file_get_contents() size limit, so here we want to
skip early to avoid an error at read time.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/PVE/LXC/Setup/Base.pm

index 0d6a79635796b9c719edc7e944e118365e2a2235..2f346e9b6c5e87bacfba74121da36afa589b6690 100644 (file)
@@ -54,6 +54,9 @@ sub lookup_dns_conf {
 sub update_etc_hosts {
     my ($self, $hostip, $oldname, $newname, $searchdomains) = @_;
 
+    my $hosts_fn = '/etc/hosts';
+    return if $self->ct_is_file_ignored($hosts_fn);
+
     my $namepart = ($newname =~ s/\..*$//r);
 
     my $all_names = '';
@@ -70,7 +73,6 @@ sub update_etc_hosts {
 
     # Prepare section:
     my $section = '';
-    my $hosts_fn = '/etc/hosts';
 
     my $lo4 = "127.0.0.1 localhost.localnet localhost\n";
     my $lo6 = "::1 localhost.localnet localhost\n";