From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 18C2FBA4A5 for ; Tue, 19 Mar 2024 16:32:59 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id F1542295A for ; Tue, 19 Mar 2024 16:32:58 +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 ; Tue, 19 Mar 2024 16:32: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 2315E48AF8 for ; Tue, 19 Mar 2024 16:32:57 +0100 (CET) From: Max Carrara To: pve-devel@lists.proxmox.com Date: Tue, 19 Mar 2024 16:32:45 +0100 Message-Id: <20240319153250.629369-1-m.carrara@proxmox.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.022 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 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [python.org, listvms.py] Subject: [pve-devel] [PATCH v1 pve-esxi-import-tools 0/5] Improve listvms.py X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2024 15:32:59 -0000 This series adds a bunch of improvements for listvms.py, most notably better typing (and thus better linting support) as well as parsing arguments via the Python STL's `argparse` [0]. For more information, please see the individual patches. All patches were additionally tested in order to ensure that the JSON output on successful invocations remains unchanged. This was done as follows: # on master ./listvms.py $ARGS | jq > ref.json # after each patch ./listvms.py $ARGS | jq > output.json diff -u ref.json output.json Furthermore, I built the repo's package and installed it on my local system, and re-added my virtual ESXi host in the storage settings. The plugin worked as expected - all my VMs on the ESXi hosts showed up and were able to be live-imported. [0]: https://docs.python.org/3.11/library/argparse.html Max Carrara (5): listvms: remove unused import and variable listvms: reorder imports listvms: improve typing and add dataclasses to represent dicts listvms: add arg parser, context manager for connections, fetch helper listvms: run formatter listvms.py | 296 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 225 insertions(+), 71 deletions(-) -- 2.39.2