From 3351aacc707d465da75cecc49209da99cc2c38e3 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 28 Feb 2018 12:41:46 +0100 Subject: [PATCH] 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 --- PVE/CLI/qm.pm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/PVE/CLI/qm.pm b/PVE/CLI/qm.pm index d33b9497..33476125 100755 --- a/PVE/CLI/qm.pm +++ b/PVE/CLI/qm.pm @@ -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 { -- 2.39.5