Skip to content

T3955: add commit-confirm example #1642

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

Merged
merged 1 commit into from
Jun 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions docs/automation/vyos-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -548,3 +548,49 @@ request, for example:
"data": null,
"error": null
}

**************
Commit-confirm
**************

For the previous two endpoints discussed, a ``commit`` command is implicit
following a succesful request operation (``set | delete | load | merge``, or
a list of ``set`` and ``delete`` operations). One can instead request a
``commit-confirm`` command by including the field ``confirm_time`` of type
int > 0. An example follows, in the alternative JSON format, for brevity,
although the standard form-data format is fine:

.. code-block:: none

curl -k -X POST -d '{"key": "MY-HTTPS-API-PLAINTEXT-KEY", "op": "merge", "string": "interfaces {\nethernet eth1 {\naddress '192.168.137.1/24'\ndescription 'internal'\n}\n}\n", "confirm_time": 1}' https://vyos/config-file

response:
{
"success": true,
"data": "Initialized commit-confirm; 1 minutes to confirm before reload\n",
"error": null
}

The committed changes will be reverted at the timeout unless confirmed.
To confirm and keep the changes:

.. code-block:: none

curl -k -X POST -d '{"key": "MY-HTTPS-API-PLAINTEXT-KEY", "op": "confirm"}' https://vyos/config-file

response:
{
"success": true,
"data": "Reload timer stopped\n",
"error": null
}

If allowed to revert to the previous configuration, the manner in which
changes are reverted is governed by:

.. code-block:: none

vyos@vyos# set system config-management commit-confirm action
Possible completions:
reload Reload previous configuration if not confirmed
reboot Reboot to saved configuration if not confirmed (default)
Loading