cloud-init: sshkeys are now files on the CLI

This requires a pve-common patch since we need to not only
load the file but also url-encode it.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2018-02-28 12:41:46 +01:00
parent 9ed7a77c6e
commit 3351aacc70

View File

@ -10,6 +10,7 @@ use Fcntl ':flock';
use File::Path;
use IO::Socket::UNIX;
use IO::Select;
use URI::Escape;
use PVE::Tools qw(extract_param);
use PVE::Cluster;
@ -663,6 +664,20 @@ my $print_agent_result = sub {
print to_json($result, { pretty => 1, canonical => 1});
};
sub param_mapping {
my ($name) = @_;
my $ssh_key_map = ['sshkeys', sub {
return URI::Escape::uri_escape(PVE::Tools::file_get_contents($_[0]));
}];
my $mapping = {
'update_vm' => [$ssh_key_map],
'create_vm' => [$ssh_key_map],
};
return $mapping->{$name};
}
our $cmddef = {
list => [ "PVE::API2::Qemu", 'vmlist', [],
{ node => $nodename }, sub {