From 2ab5db74fea2e0cab82801b67969a818d721b405 Mon Sep 17 00:00:00 2001 From: Roberto Hueso Gómez Date: Tue, 19 May 2020 12:40:35 +0200 Subject: Handle other exceptions on virtual /refresh Ths patch handles different cases when a /refresh request can be made. More specifically this handles the situation in which the VM is stopped when /refresh is called but it starts during the processing of /refresh, in this case we just send the last recorded setup. --- src/virtual/ogOperations.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/virtual') diff --git a/src/virtual/ogOperations.py b/src/virtual/ogOperations.py index d1005cc..8e2eb23 100644 --- a/src/virtual/ogOperations.py +++ b/src/virtual/ogOperations.py @@ -326,6 +326,9 @@ class OgVirtualOperations: data['partition_setup'].append(part_json) with open(self.OG_PARTITIONS_CFG_PATH, 'w+') as f: f.write(json.dumps(data, indent=4)) + except: + with open(self.OG_PARTITIONS_CFG_PATH, 'r') as f: + data = json.load(f) data = self.partitions_cfg_to_json(data) -- cgit v1.2.3-18-g5258