mirror of https://git.48k.eu/ogclient
Add software command to inventory the machine software
ogAdmClient has a support to inventory the software in a machine. This new command allows the new ogClient to execute the same script to inventory the sw. The arguments will be received from the server as a json message. Format: { "disk" : "0", "partition" : "1"}more_events
parent
2fa8aa4ff7
commit
6d1e79b8eb
|
@ -27,3 +27,7 @@ def execCMD(cmd):
|
|||
def procsession(disk, partition):
|
||||
result = subprocess.check_output([OG_PATH + 'interfaceAdm/IniciarSesion', disk, partition], shell=True)
|
||||
return result.decode('utf-8')
|
||||
|
||||
def procsoftware(disk, partition, path):
|
||||
result = subprocess.check_output([OG_PATH + 'interfaceAdm/InventarioSoftware', disk, partition, path], shell=True)
|
||||
return result.decode('utf-8')
|
||||
|
|
|
@ -40,6 +40,11 @@ class ogThread():
|
|||
msgqueue.queue.clear()
|
||||
msgqueue.put(ogOperations.procsession(disk, partition))
|
||||
|
||||
# Process software
|
||||
def procsoftware(msgqueue, disk, partition, path):
|
||||
msgqueue.queue.clear()
|
||||
msgqueue.put(ogOperations.procsoftware(disk, partition, path))
|
||||
|
||||
class ogResponses(Enum):
|
||||
BAD_REQUEST=0
|
||||
IN_PROGRESS=1
|
||||
|
@ -87,6 +92,8 @@ class ogRest():
|
|||
self.process_shellrun(client, httpparser.getCMD())
|
||||
elif ("session" in URI):
|
||||
self.process_session(client, httpparser.getDisk(), httpparser.getPartition())
|
||||
elif ("software" in URI):
|
||||
self.process_software(client, httpparser.getDisk(), httpparser.getPartition())
|
||||
else:
|
||||
client.send(self.getResponse(ogResponses.BAD_REQUEST))
|
||||
else:
|
||||
|
@ -133,3 +140,8 @@ class ogRest():
|
|||
def process_session(self, client, disk, partition):
|
||||
threading.Thread(target=ogThread.procsession, args=(self.msgqueue, disk, partition,)).start()
|
||||
client.send(self.getResponse(ogResponses.OK))
|
||||
|
||||
def process_software(self, client, disk, partition):
|
||||
path = '/tmp/CSft-' + client.ip + '-' + partition
|
||||
threading.Thread(target=ogThread.procsoftware, args=(self.msgqueue, disk, partition, path,)).start()
|
||||
client.send(self.getResponse(ogResponses.OK))
|
||||
|
|
Loading…
Reference in New Issue