mirror of https://git.48k.eu/ogclient
Fix /software command Linux operation
This patch runs the script InventarioSoftware with the right arguments. This also increases the recv buffer size for the test server.more_events
parent
d401c9ff46
commit
ca0a62f9c6
|
@ -75,7 +75,13 @@ def software(request, path, ogRest):
|
|||
partition = request.getPartition()
|
||||
|
||||
try:
|
||||
ogRest.proc = subprocess.Popen([OG_PATH + 'interfaceAdm/InventarioSoftware', disk, partition, path], stdout=subprocess.PIPE, shell=True)
|
||||
cmd = OG_PATH + 'interfaceAdm/InventarioSoftware '
|
||||
cmd += str(disk) + ' '
|
||||
cmd += str(partition) + ' '
|
||||
cmd += path
|
||||
ogRest.proc = subprocess.Popen([cmd],
|
||||
stdout=subprocess.PIPE,
|
||||
shell=True)
|
||||
(output, error) = ogRest.proc.communicate()
|
||||
except:
|
||||
raise ValueError('Error: Incorrect command value')
|
||||
|
|
|
@ -114,9 +114,9 @@ class ogThread():
|
|||
jsonResp.addElement('partition', request.getPartition())
|
||||
|
||||
f = open(path, "r")
|
||||
lines = f.readlines()
|
||||
output = f.read()
|
||||
f.close()
|
||||
jsonResp.addElement('software', lines[0])
|
||||
jsonResp.addElement('software', output)
|
||||
|
||||
response = restResponse(ogResponses.OK, jsonResp)
|
||||
client.send(response.get())
|
||||
|
@ -295,7 +295,7 @@ class ogRest():
|
|||
threading.Thread(target=ogThread.session, args=(client, request, self,)).start()
|
||||
|
||||
def process_software(self, client, request):
|
||||
path = '/tmp/CSft-' + client.ip + '-' + request.getPartition()
|
||||
path = '/tmp/CSft-' + client.ip + '-' + str(request.getPartition())
|
||||
threading.Thread(target=ogThread.software, args=(client, request, path, self,)).start()
|
||||
|
||||
def process_hardware(self, client):
|
||||
|
|
|
@ -15,6 +15,7 @@ class Server():
|
|||
_probe_msg = 'POST /probe HTTP/1.0\r\nContent-Length:'+ \
|
||||
str(len(_probe_json)) + \
|
||||
'\r\nContent-Type:application/json\r\n\r\n' + _probe_json
|
||||
_recv_buffer_size = 16384
|
||||
|
||||
def __init__(self, host='127.0.0.1', port=1234):
|
||||
self.host = host
|
||||
|
@ -40,7 +41,7 @@ class Server():
|
|||
self.conn.send(msg.encode())
|
||||
|
||||
def recv(self):
|
||||
return self.conn.recv(1024).decode('utf-8')
|
||||
return self.conn.recv(self._recv_buffer_size).decode('utf-8')
|
||||
|
||||
def stop(self):
|
||||
self.conn.close()
|
||||
|
|
Loading…
Reference in New Issue