summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOpenGnSys Support Team <soporte-og@soleta.eu>2024-06-21 14:02:54 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2024-06-21 14:47:30 +0200
commit19cd1b9a783646522bcbe46a4e4f9580c0a1d512 (patch)
tree2e82eee63ef6d8e973caeed064999370e89be465
parent399a5dceb8730314f651973a0e2ac13a7fab3efa (diff)
rest: add retcode field to POST /shell/run
provide return code as result to ogserver. Update virtual mode driver to return dummy value, although this command is unimplemented, this seems to be broken due to possible TypeError when accessing result from caller.
-rw-r--r--src/live/ogOperations.py2
-rw-r--r--src/ogRest.py3
-rw-r--r--src/virtual/ogOperations.py2
-rw-r--r--src/windows/ogOperations.py2
4 files changed, 5 insertions, 4 deletions
diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py
index 733beae..cadd0af 100644
--- a/src/live/ogOperations.py
+++ b/src/live/ogOperations.py
@@ -297,7 +297,7 @@ class OgLiveOperations:
self.refresh(ogRest)
- return output.decode('utf-8')
+ return (ogRest.proc.returncode, output.decode('utf-8'))
def session(self, request, ogRest):
disk = request.getDisk()
diff --git a/src/ogRest.py b/src/ogRest.py
index bd480a7..e7b9d95 100644
--- a/src/ogRest.py
+++ b/src/ogRest.py
@@ -92,7 +92,7 @@ class ogThread():
return
try:
- shellout = ogRest.operations.shellrun(request, ogRest)
+ (retcode, shellout) = ogRest.operations.shellrun(request, ogRest)
except Exception as e:
ogRest.send_internal_server_error(client, exc=e)
return
@@ -100,6 +100,7 @@ class ogThread():
if request.getEcho():
json_body = jsonBody()
json_body.add_element('out', shellout)
+ json_body.add_element('retcode', retcode)
response = restResponse(ogResponses.OK, json_body, seq=client.seq)
client.send(response.get())
else:
diff --git a/src/virtual/ogOperations.py b/src/virtual/ogOperations.py
index 1e2a682..003ec3d 100644
--- a/src/virtual/ogOperations.py
+++ b/src/virtual/ogOperations.py
@@ -240,7 +240,7 @@ class OgVirtualOperations:
self.poweroff_host()
def shellrun(self, request, ogRest):
- return
+ return (0, "")
def session(self, request, ogRest):
disk = request.getDisk()
diff --git a/src/windows/ogOperations.py b/src/windows/ogOperations.py
index 70d3c5b..bf35bff 100644
--- a/src/windows/ogOperations.py
+++ b/src/windows/ogOperations.py
@@ -93,7 +93,7 @@ class OgWindowsOperations:
if error.stdout:
return error.stdout
return "{Non zero exit code and empty output}"
- return result.stdout
+ return (result.returncode, result.stdout)
def session(self, request, ogRest):
raise NotImplementedError