summaryrefslogtreecommitdiffstats
path: root/cli/cli.py
diff options
context:
space:
mode:
authorJose M. Guisado <jguisado@soleta.eu>2021-03-29 13:42:44 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2021-03-29 13:47:28 +0200
commit0f55ce73415465d01f3490a8b1e770d116210eda (patch)
tree80ac8fed29b3a308ce018a1fb15eec2e126fd127 /cli/cli.py
parentbe84b0a15ce5d0ada0ac1613085420b8af206efb (diff)
Add WoL sending capability
Builds a json payload to consume the ogServer API to send WoL packets. Adds 'send' as a command: ogcli send Adds a wol object for to the 'send' command, so that sending a wol can be specified as: ogcli send wol * WoL packet type is specified with --type option. * Specifying targets follows same parameters as 'set modes' with: --client-ip --room-id --center-id
Diffstat (limited to 'cli/cli.py')
-rw-r--r--cli/cli.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/cli/cli.py b/cli/cli.py
index c23564c..87fc772 100644
--- a/cli/cli.py
+++ b/cli/cli.py
@@ -9,6 +9,7 @@
from cli.objects.client import OgClient
from cli.objects.scopes import OgScope
from cli.objects.modes import OgModes
+from cli.objects.wol import OgWol
import argparse
import requests
import sys
@@ -73,3 +74,12 @@ class OgCLI():
if parsed_args.item == 'modes':
OgModes.set_modes(self.rest, args[1:])
+
+ def send(self, args):
+ choices = ['wol']
+ parser = argparse.ArgumentParser(prog='ogcli send')
+ parser.add_argument('send_obj', choices=choices)
+ parsed_args = parser.parse_args([args[0]])
+
+ if parsed_args.send_obj == 'wol':
+ OgWol.send_wol(self.rest, args[1:])