From 96c2ddea2d407845441cd740c8330f15fc75b7a0 Mon Sep 17 00:00:00 2001 From: Roberto Hueso Gómez Date: Mon, 20 Jan 2020 12:28:41 +0100 Subject: Fix /hardware command Linux operation This patch runs the script InventarioHardware with the right arguments. --- src/linux/ogOperations.py | 5 ++++- src/ogRest.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/linux/ogOperations.py b/src/linux/ogOperations.py index 385fd95..505894b 100644 --- a/src/linux/ogOperations.py +++ b/src/linux/ogOperations.py @@ -84,7 +84,10 @@ def software(request, path, ogRest): def hardware(path, ogRest): try: - ogRest.proc = subprocess.Popen([OG_PATH + 'interfaceAdm/InventarioHardware', path], stdout=subprocess.PIPE, shell=True) + cmd = [OG_PATH + 'interfaceAdm/InventarioHardware ' + path] + ogRest.proc = subprocess.Popen(cmd, + stdout=subprocess.PIPE, + shell=True) (output, error) = ogRest.proc.communicate() except: raise ValueError('Error: Incorrect command value') diff --git a/src/ogRest.py b/src/ogRest.py index febf529..781fb80 100644 --- a/src/ogRest.py +++ b/src/ogRest.py @@ -131,9 +131,9 @@ class ogThread(): jsonResp = jsonResponse() f = open(path, "r") - lines = f.readlines() + text = f.read() f.close() - jsonResp.addElement('hardware', lines[0]) + jsonResp.addElement('hardware', text) response = restResponse(ogResponses.OK, jsonResp) client.send(response.get()) -- cgit v1.2.3-18-g5258