diff options
author | Roberto Hueso Gómez <rhueso@soleta.eu> | 2020-04-17 16:59:48 +0200 |
---|---|---|
committer | Roberto Hueso Gómez <rhueso@soleta.eu> | 2020-04-17 16:59:48 +0200 |
commit | 2e3d47b7b8db69edb5d550ccc4a46fd6512fc031 (patch) | |
tree | 0993c5fb7a71cd039ba5b2ea930a0be228894ff0 /src/ogRest.py | |
parent | 7ccc4980147954b68829d5555fcc9e5b7dd2c4ec (diff) |
Avoid writting /software output to a file
Diffstat (limited to 'src/ogRest.py')
-rw-r--r-- | src/ogRest.py | 9 |
1 files changed, 4 insertions, 5 deletions
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()) |