]> git.proxmox.com Git - pve-client.git/blobdiff - PVE/APIClient/Commands/remote.pm
allow to setup remotes without password
[pve-client.git] / PVE / APIClient / Commands / remote.pm
index 06bc1b6d2e6ee4a1269f7da7c6b6330e0ed4d5bd..781fb63818ca4104d1d4167161dbef12364c14ff 100644 (file)
@@ -61,9 +61,14 @@ __PACKAGE__->register_method ({
 
        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,
        };
@@ -80,13 +85,7 @@ __PACKAGE__->register_method ({
            };
        }
 
-       my $api = PVE::APIClient::LWP->new(
-           manual_verification     => 1,
-           register_fingerprint_cb => sub {
-               my $fp = shift @_;
-               $last_fp = $fp;
-           },
-       );
+       my $api = PVE::APIClient::LWP->new(%$setup);
        $api->login();
 
        $param->{fingerprint} = $last_fp if !defined($param->{fingerprint});