From 89b14ac4de68e835cb3d1e2c98e5418d55e9f768 Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Tue, 9 Nov 2010 17:12:23 -0800 Subject: Add commit-confirm, confirm, and rollback to bash completions. --- etc/bash_completion.d/20vyatta-cfg | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'etc') diff --git a/etc/bash_completion.d/20vyatta-cfg b/etc/bash_completion.d/20vyatta-cfg index 2679ba5..9c639dc 100755 --- a/etc/bash_completion.d/20vyatta-cfg +++ b/etc/bash_completion.d/20vyatta-cfg @@ -117,6 +117,21 @@ commit () fi } +commit-confirm () +{ + cmd="${vyatta_sbindir}/vyatta-config-mgmt.pl --action=commit-confirm \ + --minutes=5" + eval "sudo sg vyattacfg \"$cmd\" " + if [ $? = 0 ]; then + commit "$@" + fi +} + +confirm () +{ + ${vyatta_sbindir}/vyatta-config-mgmt.pl --action=confirm +} + compare () { ${vyatta_sbindir}/vyatta-config-mgmt.pl --action=diff "$@" @@ -139,6 +154,11 @@ reboot () echo "Exit from configure mode before rebooting." } +rollback () +{ + ${vyatta_sbindir}/vyatta-config-mgmt.pl --action=rollback --revnum "$@" +} + shutdown () { echo "Exit from configure mode before shutting down system." @@ -562,8 +582,10 @@ vyatta_config_complete () if (( ${#COMP_WORDS[@]} < 2 )); then _get_help_text_items=( "activate" \ + "confirm" \ "comment" \ "commit" \ + "commit-confirm" \ "compare" \ "copy" \ "deactivate" \ @@ -575,14 +597,17 @@ vyatta_config_complete () "loadkey" \ "merge" \ "rename" \ + "rollback" \ "run" \ "save" \ "set" \ "show" ) _get_help_text_helps=( \ "Activate this element" \ + "Confirm prior commit" \ "Add comment to this configuration element" \ "Commit the current set of changes" \ + "Commit the current set of changes with confirm" \ "Compare configuration revisions" \ "Copy a configuration element" \ "Deactivate this element" \ @@ -594,6 +619,7 @@ vyatta_config_complete () "Load user SSH key from a file" \ "Load configuration from a file and merge running configuration" \ "Rename a configuration element" \ + "Rollback to a prior config revision (requires reboot)" \ "Run an operational-mode command" \ "Save configuration to a file" \ "Set the value of a parameter or create a new element" \ @@ -749,6 +775,7 @@ complete -F vyatta_config_complete compare complete -F vyatta_config_complete comment complete -F vyatta_config_complete copy complete -F vyatta_config_complete rename +complete -F vyatta_config_complete rollback # Local Variables: # mode: shell-script -- cgit v1.2.3