Page MenuHomeVyOS Platform

`set failed` after VRRP transition scripts
Closed, InvalidPublicBUG

Description

I have setup a VRRP cluster with two nodes. I wrote some transition scripts to disable or reenable a zabbix-proxy container, whenever a node changes its state. The transition scripts are configured for the VRRP sync group:

set high-availability vrrp sync-group main transition-script backup "/config/scripts/ha/vrrp-backup.sh"
set high-availability vrrp sync-group main transition-script master "/config/scripts/ha/vrrp-master.sh"

The scripts look like this:

vrrp-backup.sh:

#!/bin/vbash
source /opt/vyatta/etc/functions/script-template
configure
set container name zabbix-proxy disable
commit comment "VRRP backup transition"
exit

vrrp-master.sh:

#!/bin/vbash                                                                                                                                                          
source /opt/vyatta/etc/functions/script-template                                                                                                                      
configure                                                                                                                                                             
delete container name zabbix-proxy disable                                                                                                                               
commit comment "VRRP master transition"                                                                                                                                                                
exit

Whenever a VRRP transition has occured and the scripts were executed, no config changes can be made while the error message set failed is displayed. This lasts until I reboot the machine which let me to believe that the cause for this might be that the VRRP transition scripts are currently not called with the vyattacfg group.

Details

Difficulty level
Unknown (require assessment)
Version
1.4-rolling-202303020317
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Event Timeline

To make sure that a script is not accidentally called without the vyattacfg group, the script can be safeguarded like this:

if [ "$(id -g -n)" != 'vyattacfg' ] ; then
    exec sg vyattacfg -c "/bin/vbash $(readlink -f $0) $@"
fi

https://docs.vyos.io/en/latest/automation/command-scripting.html#executing-configuration-scripts

So your script should be like

#!/bin/vbash

if [ "$(id -g -n)" != 'vyattacfg' ] ; then
    exec sg vyattacfg -c "/bin/vbash $(readlink -f $0) $@"
fi

source /opt/vyatta/etc/functions/script-template
configure
set container name zabbix-proxy disable
commit comment "VRRP backup transition"
exit

Thank you for the clarification, I will edit my scripts accordingly. I was under the impression that VRRP transition scripts are called with the vyattacfg group out of the box, since there is an example in the documentation which has the sg part missing: https://docs.vyos.io/en/latest/automation/command-scripting.html#run-configuration-commands

@dex Update please the documentation if you want to help project or we'll do it later.
Thanks

I'll take a look at the guidelines to contribute, thank you!

I can confirm that after adding the aforementioned code block to my scripts everything works as expected.