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

Christian Ebner c.ebner at proxmox.com
Mon Jan 28 10:19:28 CET 2019


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 ];
+		}
 	    }),
 	},
     },
-- 
2.11.0




More information about the pve-devel mailing list