[pve-devel] [PATCH] PVE/API2/LXC.pm ssh-public-keys alias
Geert Stappers
stappers at stappers.it
Wed Jan 31 00:24:51 CET 2018
On Wed, Jan 31, 2018 at 12:14:43AM +0100, Geert Stappers wrote:
> Parameter name 'ssh-public-keys' causes trouble
> when written as ssh-public-keys. Because it can read as
> arthmetic expression ssh minus public minus keys.
>
> So an alias to the rescue.
> Parameter name is 'ssh_public_keys'.
>
> Signed-off-by: Geert Stappers <stappers at stappers.it>
> ---
> src/PVE/API2/LXC.pm | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
> index 733826e..ae3cbd8 100644
> --- a/src/PVE/API2/LXC.pm
> +++ b/src/PVE/API2/LXC.pm
It is from repository git://git.proxmox.com/git/pve-container.git
> @@ -161,6 +161,11 @@ __PACKAGE__->register_method({
> description => "Setup public SSH keys (one key per line, " .
> "OpenSSH format).",
> },
> + 'ssh_public_keys' => {
> + optional => 1,
> + type => 'string',
> + description => "Alias for ssh-public-keys",
> + },
> }),
> },
> returns => {
> @@ -204,7 +209,12 @@ __PACKAGE__->register_method({
>
> my $password = extract_param($param, 'password');
>
> - my $ssh_keys = extract_param($param, 'ssh-public-keys');
> + my $ssh_keys;
> + my $ssh_keys_orig = extract_param($param, 'ssh-public-keys');
> + my $ssh_keys_alias = extract_param($param, 'ssh_public_keys');
> + $ssh_keys = $ssh_keys_alias if defined($ssh_keys_alias);
> + # Allow the original 'ssh-public-keys' parameter to win
> + $ssh_keys = $ssh_keys_orig if defined($ssh_keys_orig);
> PVE::Tools::validate_ssh_public_keys($ssh_keys) if defined($ssh_keys);
>
> my $pool = extract_param($param, 'pool');
> --
> 1.7.10.4
More information about the pve-devel
mailing list