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 5049F72A87 for ; Tue, 13 Apr 2021 14:16:51 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4A2C22A6D2 for ; Tue, 13 Apr 2021 14:16:51 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (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 id 2A31B2A6BC for ; Tue, 13 Apr 2021 14:16:50 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id E895145A74 for ; Tue, 13 Apr 2021 14:16:49 +0200 (CEST) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pve-devel@lists.proxmox.com Date: Tue, 13 Apr 2021 14:16:27 +0200 Message-Id: <20210413121640.3602975-10-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210413121640.3602975-1-f.gruenbichler@proxmox.com> References: <20210413121640.3602975-1-f.gruenbichler@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.027 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [remoteconfig.pm] Subject: [pve-devel] [PATCH cluster 3/4] remote: add option/completion 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, 13 Apr 2021 12:16:51 -0000 Signed-off-by: Fabian Grünbichler --- data/PVE/RemoteConfig.pm | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/data/PVE/RemoteConfig.pm b/data/PVE/RemoteConfig.pm index 7c395ba..563e5c1 100644 --- a/data/PVE/RemoteConfig.pm +++ b/data/PVE/RemoteConfig.pm @@ -5,7 +5,7 @@ use warnings; use PVE::APIClient::LWP; use PVE::Cluster qw(cfs_register_file cfs_read_file cfs_write_file cfs_lock_file); -use PVE::JSONSchema qw(get_standard_option); +use PVE::JSONSchema qw(get_standard_option register_standard_option); use PVE::Tools; use PVE::SectionConfig; @@ -33,6 +33,11 @@ my $defaultData = { }, }; +register_standard_option('pve-remote-cluster', { + description => "A remote cluster identifier.", + type => 'string', format => 'pve-node', +}); + sub private { return $defaultData; } @@ -180,7 +185,6 @@ sub get_remote_info { my $api_token = $cluster_info->{token} // $api_node->{token}; my $conn_args = { - username => 'root@pam', protocol => 'https', host => $api_node->{endpoint}, apitoken => $api_token, @@ -213,6 +217,18 @@ sub get_remote_info { return ($res, $conn_args); } +sub complete_remote_cluster { + my $conf = PVE::RemoteConfig->new(); + my $sections = $conf->{ids}; + return [ grep { $sections->{$_}->{type} eq 'pvecluster' } keys %$sections ]; +} + +sub complete_remote_node { + my $conf = PVE::RemoteConfig->new(); + my $sections = $conf->{ids}; + return [ grep { $sections->{$_}->{type} eq 'pvenode' } keys %$sections ]; +} + package PVE::RemoteConfig::Cluster; use PVE::RemoteConfig; -- 2.20.1