Пример #1
0
Файл: api.py Проект: tpot/dwarf
def _route_servers_id_action(dummy_tenant_id, server_id):
    """
    Route:  /v1.1/<dummy_tenant_id>/servers/<server_id>/action
    Method: POST
    """
    utils.show_request(bottle.request)

    body = json.load(bottle.request.body)

    # nova console-log
    if 'os-getConsoleOutput' in body:
        return {'output': SERVERS.console_log(server_id)}

    # nova reboot
    elif 'reboot' in body:
        hard = body['reboot']['type'].lower() == 'hard'
        SERVERS.reboot(server_id, hard)
        return

    bottle.abort(400)