public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Stoiko Ivanov <s.ivanov@proxmox.com>
Subject: Re: [pve-devel] [PATCH container] setup: template_fixup: remove bogus LXC_NAME line from /etc/hosts
Date: Tue, 13 Jun 2023 18:46:15 +0200	[thread overview]
Message-ID: <cf0b55aa-9e6d-1915-7151-5628d318d2ad@proxmox.com> (raw)
In-Reply-To: <20230609173627.3252569-1-s.ivanov@proxmox.com>

Am 09/06/2023 um 19:36 schrieb Stoiko Ivanov:
> diff --git a/src/PVE/LXC/Setup/Base.pm b/src/PVE/LXC/Setup/Base.pm
> index 5534397..2d14599 100644
> --- a/src/PVE/LXC/Setup/Base.pm
> +++ b/src/PVE/LXC/Setup/Base.pm
> @@ -841,4 +841,15 @@ sub remove_pve_sections {
>      return $data =~ s/^\h*\Q$head\E.*^\h*\Q$tail\E.*?$//rgms;
>  }
>  
> +# templates from images.linuxcontainers.org have a bogus LXC_NAME line in /etc/hosts
> +sub remove_lxc_name_from_etc_hosts {
> +    my ($self) = @_;
> +    my $hosts = $self->ct_file_get_contents('/etc/hosts');

This failed the build...

prepare test-alpine-001                                                                                                                                        
can't open '/etc/hosts' - No such file or directory                                                                                                            
error in setup task PVE::LXC::Setup::post_create_hook                                                                                                          
make[3]: *** [Makefile:8: test_setup] Error 1


Please add an actual test for this.

> +    my @lines = grep { !/^127.0.1.1\s+LXC_NAME$/ } split(/\n/, $hosts);
> +
> +    $hosts = join("\n", @lines). "\n";
> +
> +    $self->ct_file_set_contents('/etc/hosts', $hosts);
> +}
> +
>  1;






      parent reply	other threads:[~2023-06-13 16:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09 17:36 Stoiko Ivanov
2023-06-13 15:02 ` Stoiko Ivanov
2023-06-13 15:25 ` [pve-devel] applied: " Thomas Lamprecht
2023-06-13 16:46 ` Thomas Lamprecht [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cf0b55aa-9e6d-1915-7151-5628d318d2ad@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=s.ivanov@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal