summaryrefslogtreecommitdiffstats
path: root/src/ogRest.py
diff options
context:
space:
mode:
authorJose M. Guisado <jguisado@soleta.eu>2023-03-01 17:59:04 +0100
committerJose M. Guisado <jguisado@soleta.eu>2023-03-02 13:15:10 +0100
commitc9a3a763ddf91ccf3d382a29996c4f2f5e767d9a (patch)
tree8ec89b9b32cd8567b3110785699b786333000317 /src/ogRest.py
parenta1edbe904b3019ec77b54fdd48c01183f4c73483 (diff)
legacy: rewrite ogGetImageInfo
Rewrites this legacy script behavior using native Python code, using subprocess module when executing programs like partclone.info or lzop ogGetImageInfo is a bash script that retrieves information regarding an OpenGnsys partition image, specifically: - clonator - compressor - filesystem - datasize (size of the partition image) This rewrite only supports partclone and lzop compressed images. This is standard behavior, we have no reports of other programs or compression algorithms in use. Keep this legacy function with hungarian notation to emphasize this is still a legacy component that may be replaced in the future.
Diffstat (limited to 'src/ogRest.py')
-rw-r--r--src/ogRest.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ogRest.py b/src/ogRest.py
index 8e54612..02d3d0c 100644
--- a/src/ogRest.py
+++ b/src/ogRest.py
@@ -205,7 +205,7 @@ class ogThread():
return
kibi = 1024
- datasize = int(image_info['datasize']) * kibi
+ datasize = int(image_info.datasize) * kibi
json_body = jsonBody()
json_body.add_element('disk', request.getDisk())
@@ -215,9 +215,9 @@ class ogThread():
json_body.add_element('name', request.getName())
json_body.add_element('repository', request.getRepo())
json_body.add_element('software', software)
- json_body.add_element('clonator', image_info['clonator'])
- json_body.add_element('compressor', image_info['compressor'])
- json_body.add_element('filesystem', image_info['filesystem'])
+ json_body.add_element('clonator', image_info.clonator)
+ json_body.add_element('compressor', image_info.compressor)
+ json_body.add_element('filesystem', image_info.filesystem)
json_body.add_element('datasize', datasize)
response = restResponse(ogResponses.OK, json_body)