From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <m.carrara@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 0E819BAA51
 for <pve-devel@lists.proxmox.com>; Wed, 20 Mar 2024 18:01:02 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id EC40313F23
 for <pve-devel@lists.proxmox.com>; Wed, 20 Mar 2024 18:01:01 +0100 (CET)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS
 for <pve-devel@lists.proxmox.com>; Wed, 20 Mar 2024 18:00:57 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 7B29948B75
 for <pve-devel@lists.proxmox.com>; Wed, 20 Mar 2024 18:00:57 +0100 (CET)
Mime-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8
Date: Wed, 20 Mar 2024 18:00:56 +0100
Message-Id: <CZYQLESSLK7V.2KQGZA9SWCUPQ@proxmox.com>
Cc: <pve-devel@lists.proxmox.com>
From: "Max Carrara" <m.carrara@proxmox.com>
To: "Wolfgang Bumiller" <w.bumiller@proxmox.com>
X-Mailer: aerc 0.17.0-72-g6a84f1331f1c
References: <20240319153250.629369-1-m.carrara@proxmox.com>
 <20240319153250.629369-5-m.carrara@proxmox.com>
 <u52v7z3qz7jay5jsbwhjqlkxiwutj5tyhmxcfet7tuijhg2sqg@igj475i5x5ga>
In-Reply-To: <u52v7z3qz7jay5jsbwhjqlkxiwutj5tyhmxcfet7tuijhg2sqg@igj475i5x5ga>
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.027 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 T_SCC_BODY_TEXT_LINE    -0.01 -
Subject: Re: [pve-devel] [PATCH v1 pve-esxi-import-tools 4/5] listvms: add
 arg parser, context manager for connections, fetch helper
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Wed, 20 Mar 2024 17:01:02 -0000

On Wed Mar 20, 2024 at 1:45 PM CET, Wolfgang Bumiller wrote:
> On Tue, Mar 19, 2024 at 04:32:49PM +0100, Max Carrara wrote:
> > +@contextmanager
> > +def connect_to_esxi_host(args: EsxiConnectonArgs) -> vim.ServiceInstan=
ce:
> > +    """Opens a connection to an ESXi host with the given username and =
password
> > +    contained in the password file.
> > +    """
> > +    ssl_context =3D (
> > +        ssl._create_unverified_context()
> > +        if args.skip_cert_verification
> > +        else None
> > +    )
> > +
> > +    with open(args.password_file) as pw_file:
> > +        password =3D pw_file.read().strip()
>
> This strips all whitespace from both sides, which is not what we want.
> (Not that I particularly care whether esxi even allows spaces in
> passwords at all...)
> The old code specifically only stripped a single trailing *newline*,
> mainly for when you edit the file with eg. vim which defaults to adding
> one...

Oh, thanks for pointing this out - I had assumed that, well, passwords
wouldn't contain spaces ... ever.

Mea culpa; will fix in v2.