summaryrefslogtreecommitdiffstats
path: root/src/linux/ogOperations.py
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2020-09-10 14:03:57 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2020-09-10 14:46:37 +0200
commitc86eae48fedb6ab674b2def0daa4d5f709560a50 (patch)
tree018b7e8d98ba08d8903dbeeb6a5ed7c6df7c71d0 /src/linux/ogOperations.py
parent36b5064970ea42a06a9ac9f8d91d45da00e45f89 (diff)
#1004 Add new fields to /image/create response
Extend ogClient to include more information about the image that has been created. This patch modifies ogClient to read an info file created by image creation script, add this info to the JSON response and then remove the file. Example of new /image/create response: { "disk": "1", "partition": "1", "code": "131", "id": "1", "name": "ubuntu", "repository": "192.168.56.10", "software": "Ubuntu 18.04.5 LTS \naccountsservice 0.6.45\n...", "clonator": "PARTCLONE", "compressor": "LZOP", "filesystem": "EXTFS", "datasize": 2100000 } New fields are "clonator", "compressor", "filesystem" and "datasize".
Diffstat (limited to 'src/linux/ogOperations.py')
-rw-r--r--src/linux/ogOperations.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/linux/ogOperations.py b/src/linux/ogOperations.py
index 7f70f2b..204699a 100644
--- a/src/linux/ogOperations.py
+++ b/src/linux/ogOperations.py
@@ -239,9 +239,22 @@ class OgLinuxOperations:
except:
raise ValueError('Error: Incorrect command value')
+ with open('/tmp/image.info') as file_info:
+ line = file_info.readline().rstrip()
+
+ image_info = {}
+
+ (image_info['clonator'],
+ image_info['compressor'],
+ image_info['filesystem'],
+ image_info['datasize'],
+ image_info['clientname']) = line.split(':', 5)
+
+ os.remove('/tmp/image.info')
+
self._restartBrowser(self._url)
- return output.decode('utf-8')
+ return image_info
def refresh(self, ogRest):
self._restartBrowser(self._url_log)