Fix /hardware command Linux operation

This patch runs the script InventarioHardware with the right arguments.
more_events
Roberto Hueso Gómez 2020-01-20 12:28:41 +01:00 committed by Alvaro Neira Ayuso
parent 434bb272b5
commit 96c2ddea2d
2 changed files with 6 additions and 3 deletions

View File

@ -84,7 +84,10 @@ def software(request, path, ogRest):
def hardware(path, ogRest): def hardware(path, ogRest):
try: 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() (output, error) = ogRest.proc.communicate()
except: except:
raise ValueError('Error: Incorrect command value') raise ValueError('Error: Incorrect command value')

View File

@ -131,9 +131,9 @@ class ogThread():
jsonResp = jsonResponse() jsonResp = jsonResponse()
f = open(path, "r") f = open(path, "r")
lines = f.readlines() text = f.read()
f.close() f.close()
jsonResp.addElement('hardware', lines[0]) jsonResp.addElement('hardware', text)
response = restResponse(ogResponses.OK, jsonResp) response = restResponse(ogResponses.OK, jsonResp)
client.send(response.get()) client.send(response.get())