Skip to content

Commit 1b938c7

Browse files
author
Niklas Femerstrand
authored
Adds option command to api client
1 parent 5a08b71 commit 1b938c7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

lib/utils/api.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,22 @@ def client(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT):
745745
if not res["success"]:
746746
logger.error("Failed to execute command %s" % command)
747747
dataToStdout("%s\n" % raw)
748+
749+
if command.startswith("option"):
750+
if not taskid:
751+
logger.error("No task ID in use")
752+
continue
753+
try:
754+
command, option = command.split(" ")
755+
except ValueError:
756+
raw = _client("%s/option/%s/list" % (addr, taskid))
757+
else:
758+
options = {"option": option}
759+
raw = _client("%s/option/%s/get" % (addr, taskid), options)
760+
res = dejsonize(raw)
761+
if not res["success"]:
762+
logger.error("Failed to execute command %s" % command)
763+
dataToStdout("%s\n" % raw)
748764

749765
elif command.startswith("new"):
750766
if ' ' not in command:
@@ -809,6 +825,7 @@ def client(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT):
809825
msg += "data Retrieve and show data for current task\n"
810826
msg += "log Retrieve and show log for current task\n"
811827
msg += "status Retrieve and show status for current task\n"
828+
msg += "option Retrieve and show options for current task\n"
812829
msg += "stop Stop current task\n"
813830
msg += "kill Kill current task\n"
814831
msg += "list Display all tasks\n"

0 commit comments

Comments
 (0)