Fix /image/restore execution and response

more_events
Roberto Hueso Gómez 2020-02-05 12:39:42 +01:00 committed by Alvaro Neira Ayuso
parent 680214317e
commit fe4236dcd8
2 changed files with 10 additions and 1 deletions

View File

@ -137,9 +137,13 @@ def image_restore(request, ogRest):
ctype = request.getType()
profile = request.getProfile()
cid = request.getId()
cmd = f'{OG_PATH}interfaceAdm/RestaurarImagen {disk} {partition} ' \
f'{name} {repo} {ctype}'
try:
ogRest.proc = subprocess.Popen([OG_PATH + 'interfaceAdm/RestaurarImagen', disk, partition, name, repo, ctype], stdout=subprocess.PIPE, shell=True)
ogRest.proc = subprocess.Popen([cmd],
stdout=subprocess.PIPE,
shell=True)
(output, error) = ogRest.proc.communicate()
except:
raise ValueError('Error: Incorrect command value')

View File

@ -161,6 +161,11 @@ class ogThread():
client.send(response.get())
return
jsonResp = jsonResponse()
jsonResp.addElement('disk', request.getDisk())
jsonResp.addElement('partition', request.getPartition())
jsonResp.addElement('image_id', request.getId())
response = restResponse(ogResponses.OK, jsonResp)
client.send(response.get())