+ my $trylogin = sub {
+ my ($ticket_or_password) = @_;
+
+ if (!defined($ticket_or_password)) {
+ $ticket_or_password = PVE::APIClient::PTY::read_password("Remote password: ")
+ }
+
+ my $setup = {
+ username => $section->{username},
+ password => $ticket_or_password,
+ host => $section->{host},
+ port => $section->{port} // 8006,
+ cached_fingerprints => {
+ $section->{fingerprint} => 1,
+ }
+ };
+
+ my $conn = PVE::APIClient::LWP->new(%$setup);
+
+ $conn->login();
+
+ return $conn;
+ };
+