use strict;
use warnings;
-use PVE::JSONSchema qw(get_standard_option);
-use PVE::Tools qw(extract_param);
+use PVE::APIClient::JSONSchema qw(get_standard_option);
+use PVE::APIClient::Tools qw(extract_param);
use PVE::APIClient::Config;
-use PVE::CLIHandler;
+use PVE::APIClient::CLIHandler;
use PVE::APIClient::LWP;
-use PVE::PTY ();
+use PVE::APIClient::PTY;
-use base qw(PVE::CLIHandler);
+use base qw(PVE::APIClient::CLIHandler);
sub read_password {
return PVE::PTY::read_password("Remote password: ")
printf("%10s %10s %10s %10s %100s\n", "Name", "Host", "Port", "Username", "Fingerprint");
for my $name (keys %{$config->{ids}}) {
- my $remote = $config->{ids}->{$name};
- printf("%10s %10s %10s %10s %100s\n", $name, $remote->{'host'},
- $remote->{'port'} // '-', $remote->{'username'}, $remote->{'fingerprint'} // '-');
+ my $data = $config->{ids}->{$name};
+ next if $data->{type} ne 'remote';
+ printf("%10s %10s %10s %10s %100s\n", $name, $data->{'host'},
+ $data->{'port'} // '-', $data->{'username'}, $data->{'fingerprint'} // '-');
}
return undef;
path => 'add',
method => 'POST',
description => "Add a remote to your config file.",
- parameters => PVE::APIClient::Config->createSchema(1),
+ parameters => PVE::APIClient::RemoteConfig->createSchema(1),
returns => { type => 'null'},
code => sub {
my ($param) = @_;
my $last_fp = 0;
+ my $password = $param->{password};
+ if (!defined($password)) {
+ $password = PVE::PTY::read_password("Remote password: ");
+ }
+
my $setup = {
username => $param->{username},
- password => $param->{password},
+ password => $password,
host => $param->{host},
port => $param->{port} // 8006,
};
path => 'update',
method => 'PUT',
description => "Update a remote configuration.",
- parameters => PVE::APIClient::Config->updateSchema(1),
+ parameters => PVE::APIClient::RemoteConfig->updateSchema(1),
returns => { type => 'null'},
code => sub {
my ($param) = @_;
if ($delete) {
my $options = $plugin->private()->{options}->{'remote'};
- foreach my $k (PVE::Tools::split_list($delete)) {
+ foreach my $k (PVE::APIClient::Tools::APIClient::split_list($delete)) {
my $d = $options->{$k} ||
die "no such option '$k'\n";
die "unable to delete required option '$k'\n"