[pve-devel] applied: [PATCH v2 manager] Add bash completion for wakeonlan API call

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Jan 28 17:32:04 CET 2019


On 1/28/19 10:19 AM, Christian Ebner wrote:
> This adds the bash completion for the wakeonlan API call.
> The bash completion returns only those nodes which are offline according to the
> member status.
> 
> Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
> ---
> Version 2:
>     * Use more concise way as suggested via mailing list
>     * Return those nodes which are not online
> 
>  PVE/API2/Nodes.pm | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
> index 52f537ba..3c450bb8 100644
> --- a/PVE/API2/Nodes.pm
> +++ b/PVE/API2/Nodes.pm
> @@ -482,6 +482,10 @@ __PACKAGE__->register_method({
>  	properties => {
>  	    node => get_standard_option('pve-node', {
>  		description => 'target node for wake on LAN packet',
> +		completion => sub {
> +		    my $members = PVE::Cluster::get_members();
> +		    return [ grep { !$members->{$_}->{online} } keys %$members ];
> +		}
>  	    }),
>  	},
>      },
> 

applied, thanks!




More information about the pve-devel mailing list