[pve-devel] [PATCH manager] Add bash completion for wakeonlan API call
Christian Ebner
c.ebner at proxmox.com
Fri Jan 25 17:03:04 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>
---
PVE/API2/Nodes.pm | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index 52f537ba..5d80d4b4 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -482,6 +482,17 @@ __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();
+ my $res = [];
+ foreach my $node (keys %$members) {
+ if (!$members->{$node}->{online}) {
+ push @$res, $node;
+ }
+ }
+
+ return $res;
+ }
}),
},
},
--
2.11.0
More information about the pve-devel
mailing list