So we only sort the enum keys once and the documentation and API dumps don't keep reordering them, and to deduplicate the cmd and cmd-opts schema.
Signed-off-by: Wolfgang Bumiller <w.bumil...@proxmox.com> --- PVE/API2/Nodes.pm | 68 ++++++++++++++--------------------------------- 1 file changed, 20 insertions(+), 48 deletions(-) diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm index ce7eecaf1..636789277 100644 --- a/PVE/API2/Nodes.pm +++ b/PVE/API2/Nodes.pm @@ -1103,6 +1103,23 @@ my $shell_cmd_map = { }, }; +my @shell_cmd_params = ( + cmd => { + type => 'string', + description => "Run specific command or default to login (requires 'root\@pam')", + enum => [sort keys %$shell_cmd_map], + optional => 1, + default => 'login', + }, + 'cmd-opts' => { + type => 'string', + description => "Add parameters to a command. Encoded as null terminated strings.", + requires => 'cmd', + optional => 1, + default => '', + }, +); + sub get_shell_command { my ($user, $shellcmd, $args) = @_; @@ -1156,22 +1173,7 @@ __PACKAGE__->register_method({ additionalProperties => 0, properties => { node => get_standard_option('pve-node'), - cmd => { - type => 'string', - description => - "Run specific command or default to login (requires 'root\@pam')", - enum => [keys %$shell_cmd_map], - optional => 1, - default => 'login', - }, - 'cmd-opts' => { - type => 'string', - description => - "Add parameters to a command. Encoded as null terminated strings.", - requires => 'cmd', - optional => 1, - default => '', - }, + @shell_cmd_params, websocket => { optional => 1, type => 'boolean', @@ -1307,22 +1309,7 @@ __PACKAGE__->register_method({ additionalProperties => 0, properties => { node => get_standard_option('pve-node'), - cmd => { - type => 'string', - description => - "Run specific command or default to login (requires 'root\@pam')", - enum => [keys %$shell_cmd_map], - optional => 1, - default => 'login', - }, - 'cmd-opts' => { - type => 'string', - description => - "Add parameters to a command. Encoded as null terminated strings.", - requires => 'cmd', - optional => 1, - default => '', - }, + @shell_cmd_params, }, }, returns => { @@ -1437,22 +1424,7 @@ __PACKAGE__->register_method({ properties => { node => get_standard_option('pve-node'), proxy => get_standard_option('spice-proxy', { optional => 1 }), - cmd => { - type => 'string', - description => - "Run specific command or default to login (requires 'root\@pam')", - enum => [keys %$shell_cmd_map], - optional => 1, - default => 'login', - }, - 'cmd-opts' => { - type => 'string', - description => - "Add parameters to a command. Encoded as null terminated strings.", - requires => 'cmd', - optional => 1, - default => '', - }, + @shell_cmd_params, }, }, returns => get_standard_option('remote-viewer-config'), -- 2.47.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel