Changes the machine’s hostname. Expects a JSON data structure in the request body that contains the new hostname as string. Example: { "hostname": "grandpilot" } Returns: Empty response on success, error object otherwise.
()
| 480 | @api_blueprint.route('/hostname', methods=['PUT']) |
| 481 | @required_auth(auth.Role.ADMIN) |
| 482 | def hostname_set(): |
| 483 | """Changes the machine’s hostname. |
| 484 | |
| 485 | Expects a JSON data structure in the request body that contains the |
| 486 | new hostname as string. Example: |
| 487 | { |
| 488 | "hostname": "grandpilot" |
| 489 | } |
| 490 | |
| 491 | Returns: |
| 492 | Empty response on success, error object otherwise. |
| 493 | """ |
| 494 | try: |
| 495 | new_hostname = request_parsers.hostname.parse_hostname(flask.request) |
| 496 | hostname.change(new_hostname) |
| 497 | return json_response.success() |
| 498 | except request_parsers.errors.Error as e: |
| 499 | return json_response.error(e), 400 |
| 500 | except hostname.Error as e: |
| 501 | return json_response.error(e), 500 |
| 502 | |
| 503 | |
| 504 | @api_blueprint.route('/network/status', methods=['GET']) |
nothing calls this directly
no outgoing calls
no test coverage detected