Page MenuHomeVyOS Platform

vyatta-cfg-cmd-wrapper missing ${vyos_libexec_dir} variable
Closed, ResolvedPublicBUG

Description

In file: /opt/vyatta/sbin/vyatta-cfg-cmd-wrapper

Commit 9e74ad7 changed the vyos-load-config.py script directory prefix to use ${vyos_libexec_dir}. However, the ${vyos_libexec_dir} variable is not exported at the start of the wrapper script.

When executing the load command over an SSH session it tries to execute the vyos-load-config.py script from root, and not /usr/libexec/vyos where the script resides

$ /opt/scripts/vyos/reset-router-config.pl --debug
[--] Resetting VyOS router configuration...
[??] Connection vyos:[email protected] established successfully
[??] Command  : /opt/vyatta/sbin/vyatta-cfg-cmd-wrapper begin
[??] Command  : /opt/vyatta/sbin/vyatta-cfg-cmd-wrapper load config.boot.sauron.master
/opt/vyatta/sbin/vyatta-cfg-cmd-wrapper: line 84: /vyos-load-config.py: No such file or directory
[??] Error running command: /opt/vyatta/sbin/vyatta-cfg-cmd-wrapper load config.boot.sauron.master
[??] child exited with code 127
[??] Command  : /opt/vyatta/sbin/vyatta-cfg-cmd-wrapper commit
[??] Command  : /opt/vyatta/sbin/vyatta-cfg-cmd-wrapper end

Details

Difficulty level
Easy (less than an hour)
Version
VyOS 1.4-rolling-202302140317
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)

Event Timeline

Your current version is too old, this function has been changed or removed, try upgrading to the new rolling version.

image.png (313×491 px, 17 KB)

image.png (40×622 px, 4 KB)

Nope it hasn't, you skim read the bug report.

/opt/scripts/vyos/reset-router-config.pl is my script that executes commands over SSH to change the config.

Error output is here:

[??] Command  : /opt/vyatta/sbin/vyatta-cfg-cmd-wrapper load config.boot.sauron.master
/opt/vyatta/sbin/vyatta-cfg-cmd-wrapper: line 84: /vyos-load-config.py: No such file or directory

In commit 9e74ad7, line 84 in vyatta-cfg-cmd-wrapper was changed from:
exec ${vyatta_sbindir}/vyatta-load-config.pl "${@:2}"
to
exec ${vyos_libexec_dir}/vyos-load-config.py "${@:2}"

No where in vyatta-cfg-cmd-wrapper does it pull in the variable for ${vyos_libexec_dir}, but the old variable ${vyatta_sbindir} is defined at the top of the script on line 27:
export vyatta_sbindir=/opt/vyatta/sbin

You can try edit with sudo nano /opt/vyatta/sbin/vyatta-cfg-cmd-wrapper

after line 27, add command export vyos_libexec_dir=/usr/libexec/vyos

save and test script again

That did fix the issue. So how do I get that change in the main code?

$ /opt/scripts/vyos/reset-router-config.pl --debug
[--] Resetting VyOS router configuration...
[??] Connection vyos:[email protected] established successfully
[??] Command  : /opt/vyatta/sbin/vyatta-cfg-cmd-wrapper begin
[??] Command  : /opt/vyatta/sbin/vyatta-cfg-cmd-wrapper load /config/config.boot.sauron.master
[??] Loading configuration from '/config/config.boot.sauron.master'

[??] No configuration changes to commit.

[??] Command  : /opt/vyatta/sbin/vyatta-cfg-cmd-wrapper commit
[??] Command  : /opt/vyatta/sbin/vyatta-cfg-cmd-wrapper end
[OK] VyOS router configuration reset complete.
Viacheslav assigned this task to cuongdt1994.
Viacheslav moved this task from Need Triage to Finished on the VyOS 1.4 Sagitta board.