From e20daf639dd271268b172b42adc0d1b9d2103883 Mon Sep 17 00:00:00 2001 From: Alvaro Neira Ayuso Date: Fri, 27 Dec 2019 13:46:49 +0100 Subject: Add shell run and output commands Opengnsys needs a support to execute commands on the machine. This patch adds the support for executing two new commands "shell/run" and "shell/output". The first one, give us the support for executing a command in the machine and keep save in a queue the output. The second one, give us the support for sending the output from the command executed. --- src/ogClient.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ogClient.py') diff --git a/src/ogClient.py b/src/ogClient.py index fb87bac..6aceeaa 100644 --- a/src/ogClient.py +++ b/src/ogClient.py @@ -18,6 +18,7 @@ class ogClient: def __init__(self, ip, port): self.ip = ip self.port = port + self.ogrest = ogRest() def get_socket(self): return self.sock @@ -74,7 +75,6 @@ class ogClient: self.data = self.data + data httpparser = HTTPParser() - ogrest = ogRest() if not self.trailer: if self.data.find("\r\n") > 0: @@ -89,7 +89,7 @@ class ogClient: if self.trailer and len(self.data) >= self.content_len: httpparser.parser(self.data) - ogrest.processOperation(httpparser.getRequestOP(), httpparser.getURI(), self) + self.ogrest.processOperation(httpparser.getRequestOP(), httpparser.getURI(), httpparser.getCMD(), self) # Cleanup state information from request self.data = "" -- cgit v1.2.3-18-g5258