Add UNICAST-DIRECT method to image restore

Previously the only method (in the form select) was "UNICAST". This
patch enables specifying a correct parameter for the underlying script
to fetch the image to be restored.

UNICAST-DIRECT makes the administrator transfer the image through the
network. UNICAST-CACHE indicates the taget pc to search for the image in
its cache partition.

Also redirects to the /scopes when ogserver responds with 200 OK.
multi-ogserver
Jose M. Guisado 2021-02-10 11:46:06 +00:00
parent 95b28c9403
commit 3eda3fa684
2 changed files with 3 additions and 2 deletions

View File

@ -49,7 +49,8 @@ class ImageRestoreForm(FlaskForm):
partition = SelectField(label=_('Partition'), choices=[])
image = SelectField(label=_('Image'), choices=[])
method = SelectField(label=_('Method'),
choices=[('UNICAST', 'Unicast')])
choices=[('UNICAST-CACHE', 'Unicast Cache'),
('UNICAST-DIRECT', 'Unicast Direct')])
restore = SubmitField(label=_('Restore'))
class ClientDetailsForm(FlaskForm):

View File

@ -252,7 +252,7 @@ def action_image_restore():
'id': str(image['id'])}
g.server.post('/image/restore', payload)
if r.status_code == requests.codes.ok:
return make_response("200 OK", 200)
return redirect(url_for("scopes"))
return make_response("400 Bad Request", 400)
else:
ips = parse_ips(request.args.to_dict())