[pve-devel] applied: [PATCH container] fix #1844: check /etc/.pve-ignore.hosts early

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Jul 20 09:03:54 CEST 2018


Am 07/20/2018 um 08:49 AM schrieb Wolfgang Bumiller:
> 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 at proxmox.com>
> ---
>   src/PVE/LXC/Setup/Base.pm | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/PVE/LXC/Setup/Base.pm b/src/PVE/LXC/Setup/Base.pm
> index 0d6a796..2f346e9 100644
> --- a/src/PVE/LXC/Setup/Base.pm
> +++ b/src/PVE/LXC/Setup/Base.pm
> @@ -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";
> 

applied, thanks




More information about the pve-devel mailing list