[pve-devel] [PATCH manager] api: factor out shell command schema
Thomas Lamprecht
t.lamprecht at proxmox.com
Wed Sep 3 18:01:22 CEST 2025
Am 02.09.25 um 14:55 schrieb Wolfgang Bumiller:
> 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.bumiller at 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 = (
not really much difference in practice, but why not a %hash map?
> + 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 => '',
> + },
> +);
> +
More information about the pve-devel
mailing list