Add reboot action

This action handles reboot on one or multiple scopes.
multi-ogserver
Roberto Hueso Gómez 2020-09-03 11:50:58 +02:00
parent ef609cf52a
commit 73a6e07b83
2 changed files with 9 additions and 0 deletions

View File

@ -33,6 +33,8 @@
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<input class="dropdown-item" type="submit" value="{{ _('Poweroff') }}"
formaction="{{ url_for('action_poweroff') }}">
<input class="dropdown-item" type="submit" value="{{ _('Reboot') }}"
formaction="{{ url_for('action_reboot') }}">
</div>
</div>
</form>

View File

@ -48,3 +48,10 @@ def action_poweroff():
payload = {'clients': list(ips)}
g.server.post('/poweroff', payload)
return make_response("200 OK", 200)
@app.route('/action/reboot', methods=['POST'])
def action_reboot():
ips = parse_ips(request.form.to_dict())
payload = {'clients': list(ips)}
g.server.post('/reboot', payload)
return make_response("200 OK", 200)