public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: Max Carrara <m.carrara@proxmox.com>
Cc: pve-devel@lists.proxmox.com
Subject: Re: [pve-devel] [PATCH v1 pve-esxi-import-tools 4/5] listvms: add arg parser, context manager for connections, fetch helper
Date: Wed, 20 Mar 2024 13:45:59 +0100	[thread overview]
Message-ID: <u52v7z3qz7jay5jsbwhjqlkxiwutj5tyhmxcfet7tuijhg2sqg@igj475i5x5ga> (raw)
In-Reply-To: <20240319153250.629369-5-m.carrara@proxmox.com>

On Tue, Mar 19, 2024 at 04:32:49PM +0100, Max Carrara wrote:
> +@contextmanager
> +def connect_to_esxi_host(args: EsxiConnectonArgs) -> vim.ServiceInstance:
> +    """Opens a connection to an ESXi host with the given username and password
> +    contained in the password file.
> +    """
> +    ssl_context = (
> +        ssl._create_unverified_context()
> +        if args.skip_cert_verification
> +        else None
> +    )
> +
> +    with open(args.password_file) as pw_file:
> +        password = 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...




  parent reply	other threads:[~2024-03-20 12:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-19 15:32 [pve-devel] [PATCH v1 pve-esxi-import-tools 0/5] Improve listvms.py Max Carrara
2024-03-19 15:32 ` [pve-devel] [PATCH v1 pve-esxi-import-tools 1/5] listvms: remove unused import and variable Max Carrara
2024-03-19 15:32 ` [pve-devel] [PATCH v1 pve-esxi-import-tools 2/5] listvms: reorder imports Max Carrara
2024-03-19 15:32 ` [pve-devel] [PATCH v1 pve-esxi-import-tools 3/5] listvms: improve typing and add dataclasses to represent dicts Max Carrara
2024-03-20  9:38   ` Lukas Wagner
2024-03-20 10:08     ` Max Carrara
2024-03-19 15:32 ` [pve-devel] [PATCH v1 pve-esxi-import-tools 4/5] listvms: add arg parser, context manager for connections, fetch helper Max Carrara
2024-03-20  9:39   ` Lukas Wagner
2024-03-20 10:08     ` Max Carrara
2024-03-20 12:45   ` Wolfgang Bumiller [this message]
2024-03-20 17:00     ` Max Carrara
2024-03-19 15:32 ` [pve-devel] [PATCH v1 pve-esxi-import-tools 5/5] listvms: run formatter Max Carrara
2024-03-20  9:42 ` [pve-devel] [PATCH v1 pve-esxi-import-tools 0/5] Improve listvms.py Lukas Wagner
2024-03-20 10:08   ` Max Carrara

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=u52v7z3qz7jay5jsbwhjqlkxiwutj5tyhmxcfet7tuijhg2sqg@igj475i5x5ga \
    --to=w.bumiller@proxmox.com \
    --cc=m.carrara@proxmox.com \
    --cc=pve-devel@lists.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