mirror of https://git.48k.eu/ogclient
Add hardware command to inventory the machine hardware
ogAdmClient has a support to inventory the hardware in a machine. This new command allows the new ogClient to execute the same script to inventory the hw. No arguments needed for executing the commandmore_events
parent
6d1e79b8eb
commit
261a5edf7c
|
@ -31,3 +31,7 @@ def procsession(disk, partition):
|
||||||
def procsoftware(disk, partition, path):
|
def procsoftware(disk, partition, path):
|
||||||
result = subprocess.check_output([OG_PATH + 'interfaceAdm/InventarioSoftware', disk, partition, path], shell=True)
|
result = subprocess.check_output([OG_PATH + 'interfaceAdm/InventarioSoftware', disk, partition, path], shell=True)
|
||||||
return result.decode('utf-8')
|
return result.decode('utf-8')
|
||||||
|
|
||||||
|
def prochardware(path):
|
||||||
|
result = subprocess.check_output([OG_PATH + 'interfaceAdm/InventarioHardware', path], shell=True)
|
||||||
|
return result.decode('utf-8')
|
||||||
|
|
|
@ -45,6 +45,11 @@ class ogThread():
|
||||||
msgqueue.queue.clear()
|
msgqueue.queue.clear()
|
||||||
msgqueue.put(ogOperations.procsoftware(disk, partition, path))
|
msgqueue.put(ogOperations.procsoftware(disk, partition, path))
|
||||||
|
|
||||||
|
# Process hardware
|
||||||
|
def prochardware(msgqueue, path):
|
||||||
|
msgqueue.queue.clear()
|
||||||
|
msgqueue.put(ogOperations.prochardware(path))
|
||||||
|
|
||||||
class ogResponses(Enum):
|
class ogResponses(Enum):
|
||||||
BAD_REQUEST=0
|
BAD_REQUEST=0
|
||||||
IN_PROGRESS=1
|
IN_PROGRESS=1
|
||||||
|
@ -81,6 +86,8 @@ class ogRest():
|
||||||
self.process_probe(client)
|
self.process_probe(client)
|
||||||
elif ("shell/output" in URI):
|
elif ("shell/output" in URI):
|
||||||
self.process_shellout(client)
|
self.process_shellout(client)
|
||||||
|
elif ("hardware" in URI):
|
||||||
|
self.process_hardware(client)
|
||||||
else:
|
else:
|
||||||
client.send(self.getResponse(ogResponses.BAD_REQUEST))
|
client.send(self.getResponse(ogResponses.BAD_REQUEST))
|
||||||
elif ("POST" in op):
|
elif ("POST" in op):
|
||||||
|
@ -145,3 +152,8 @@ class ogRest():
|
||||||
path = '/tmp/CSft-' + client.ip + '-' + partition
|
path = '/tmp/CSft-' + client.ip + '-' + partition
|
||||||
threading.Thread(target=ogThread.procsoftware, args=(self.msgqueue, disk, partition, path,)).start()
|
threading.Thread(target=ogThread.procsoftware, args=(self.msgqueue, disk, partition, path,)).start()
|
||||||
client.send(self.getResponse(ogResponses.OK))
|
client.send(self.getResponse(ogResponses.OK))
|
||||||
|
|
||||||
|
def process_hardware(self, client):
|
||||||
|
path = '/tmp/Chrd-' + client.ip
|
||||||
|
threading.Thread(target=ogThread.prochardware, args=(self.msgqueue, path,)).start()
|
||||||
|
client.send(self.getResponse(ogResponses.OK))
|
||||||
|
|
Loading…
Reference in New Issue