Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T5767: HTTPS API add reboot and poweroff endpoints #2516

Merged
merged 1 commit into from
Nov 21, 2023

Conversation

sever-sever
Copy link
Member

@sever-sever sever-sever commented Nov 21, 2023

Change Summary

Add the ability to reboot and poweroff the system via API

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

Related PR(s)

Component(s) name

api

Proposed changes

How to test

$ curl -k --location --request POST 'https://192.168.122.14/reboot' \
  --form data='{"op": "reboot", "path": ["now"]}' \
  --form key='foo'
{"success": true, "data": "Warning: there are unsaved configuration changes!\nRun 'save' command if you do not want to lose those changes after reboot/shutdown.\n\n", "error": null}


$ curl -k --location --request POST 'https://192.168.122.14/poweroff' \
  --form data='{"op": "poweroff", "path": ["now"]}' \
  --form key='foo'

{"success": true, "data": "Warning: there are unsaved configuration changes!\nRun 'save' command if you do not want to lose those changes after reboot/shutdown.\n\n", "error": null}

Smoketest result

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

Add ability to reboot and poweroff the system via API

curl -k --location --request POST 'https://vyos/reboot' \
  --form data='{"op": "reboot", "path": ["now"]}' \
  --form key='apikey'

curl -k --location --request POST 'https://vyos/poweroff' \
  --form data='{"op": "poweroff", "path": ["now"]}' \
  --form key='apikey'
@vyosbot vyosbot requested review from a team, dmbaturin, sarthurdev, zdc, jestabro and c-po and removed request for a team November 21, 2023 10:22
@c-po c-po merged commit 821eaea into vyos:current Nov 21, 2023
8 checks passed
@sever-sever
Copy link
Member Author

@Mergifyio backport sagitta

Copy link
Contributor

mergify bot commented Nov 21, 2023

backport sagitta

✅ Backports have been created

dmbaturin added a commit that referenced this pull request Nov 22, 2023
T5767: HTTPS API add reboot and poweroff endpoints (backport #2516)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants