From: Dietmar Maurer Date: Thu, 14 Jun 2018 07:13:50 +0000 (+0200) Subject: update files from pve-common X-Git-Url: https://git.proxmox.com/?p=pve-client.git;a=commitdiff_plain;h=0cdec2275373c7ff44e4b44169ec1dc98004ae7d update files from pve-common Includes some changes which are still not applied. --- diff --git a/PVE/APIClient/CLIHandler.pm b/PVE/APIClient/CLIHandler.pm index a1cd528..a5017f6 100644 --- a/PVE/APIClient/CLIHandler.pm +++ b/PVE/APIClient/CLIHandler.pm @@ -4,7 +4,6 @@ use strict; use warnings; use PVE::APIClient::SafeSyslog; -use PVE::APIClient::Exception qw(raise raise_param_exc); use PVE::APIClient::RESTHandler; @@ -132,7 +131,7 @@ sub generate_usage_str { $cli_handler_class->can('string_param_file_mapping'); my ($subcmd, $def, undef, undef, $cmdstr) = resolve_cmd($cmd); - die "no such command '$cmd->[0]'\n" if !defined($def) && ref($cmd) eq 'ARRAY'; + $abort->("unknown command '$cmdstr'") if !defined($def) && ref($cmd) eq 'ARRAY'; my $generate; $generate = sub { @@ -314,7 +313,7 @@ my $print_bash_completion = sub { shift @$args; # no need for program name my $print_result = sub { foreach my $p (@_) { - print "$p\n" if $p =~ m/^$cur/; + print "$p\n" if $p =~ m/^\Q$cur\E/; } }; diff --git a/PVE/APIClient/PTY.pm b/PVE/APIClient/PTY.pm index 00010df..ee5010c 100644 --- a/PVE/APIClient/PTY.pm +++ b/PVE/APIClient/PTY.pm @@ -228,6 +228,13 @@ sub read_password($;$$) { return $password; } +sub get_confirmed_password { + my $pw1 = read_password('Enter new password: '); + my $pw2 = read_password('Retype new password: '); + die "passwords do not match\n" if $pw1 ne $pw2; + return $pw1; +} + # Class functions sub new { diff --git a/PVE/APIClient/RESTHandler.pm b/PVE/APIClient/RESTHandler.pm index ef30ba9..c16f42f 100644 --- a/PVE/APIClient/RESTHandler.pm +++ b/PVE/APIClient/RESTHandler.pm @@ -4,7 +4,7 @@ use strict; no strict 'refs'; # our autoload requires this use warnings; use PVE::APIClient::SafeSyslog; -use PVE::APIClient::Exception qw(raise raise_param_exc); +use PVE::APIClient::Exception qw(raise); use PVE::APIClient::JSONSchema; use PVE::APIClient::Tools; use HTTP::Status qw(:constants :is status_message); diff --git a/PVE/APIClient/SectionConfig.pm b/PVE/APIClient/SectionConfig.pm index 28224e8..bd428eb 100644 --- a/PVE/APIClient/SectionConfig.pm +++ b/PVE/APIClient/SectionConfig.pm @@ -3,7 +3,6 @@ package PVE::APIClient::SectionConfig; use strict; use warnings; use Digest::SHA; -use PVE::APIClient::Exception qw(raise_param_exc); use PVE::APIClient::JSONSchema qw(get_standard_option); use Data::Dumper;