From 2e3d47b7b8db69edb5d550ccc4a46fd6512fc031 Mon Sep 17 00:00:00 2001 From: Roberto Hueso Gómez Date: Fri, 17 Apr 2020 16:59:48 +0200 Subject: Avoid writting /software output to a file --- src/ogRest.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/ogRest.py') diff --git a/src/ogRest.py b/src/ogRest.py index 24c8a70..4fb2bba 100644 --- a/src/ogRest.py +++ b/src/ogRest.py @@ -119,7 +119,7 @@ class ogThread(): def software(client, request, path, ogRest): try: - ogRest.operations.software(request, path, ogRest) + software = ogRest.operations.software(request, path, ogRest) except ValueError as err: response = restResponse(ogResponses.INTERNAL_ERR) client.send(response.get()) @@ -128,8 +128,7 @@ class ogThread(): json_body = jsonBody() json_body.add_element('partition', request.getPartition()) - with open(path, 'r') as f: - json_body.add_element('software', f.read()) + json_body.add_element('software', software) response = restResponse(ogResponses.OK, json_body) client.send(response.get()) @@ -188,6 +187,7 @@ class ogThread(): def image_create(client, path, request, ogRest): try: ogRest.operations.image_create(path, request, ogRest) + software = ogRest.operations.software(request, path, ogRest) except ValueError as err: response = restResponse(ogResponses.INTERNAL_ERR) client.send(response.get()) @@ -201,8 +201,7 @@ class ogThread(): json_body.add_element('id', request.getId()) json_body.add_element('name', request.getName()) json_body.add_element('repository', request.getRepo()) - with open(path, 'r') as f: - json_body.add_element('software', f.read()) + json_body.add_element('software', software) response = restResponse(ogResponses.OK, json_body) client.send(response.get()) -- cgit v1.2.3-18-g5258