summaryrefslogtreecommitdiffstats
path: root/ogcp
diff options
context:
space:
mode:
Diffstat (limited to 'ogcp')
-rw-r--r--ogcp/views.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/ogcp/views.py b/ogcp/views.py
index 0133954..886ff13 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -837,7 +837,6 @@ def action_image_restore():
for image in images[repo_id]:
form.image.choices.append((image['id'], image['name']))
- has_cache = False
part_choices = []
for ip in ips:
r = server.get('/client/setup', payload={'client': [ip]})
@@ -846,6 +845,8 @@ def action_image_restore():
if r.status_code != requests.codes.ok:
return ogserver_error('commands')
+ has_cache = False
+
partitions = r.json()['partitions']
parts = []
for partition in partitions:
@@ -854,7 +855,7 @@ def action_image_restore():
if part_id == 0: # This is the disk data, not a partition.
continue
part_code = partition['code']
- if part_code == 'CACHE':
+ if PART_TYPE_CODES.get(int(part_code), 'UNKNOWN') == 'CACHE':
has_cache = True
filesystem = partition['filesystem']
part_size = partition['size']