Page MenuHomeVyOS Platform

Allow embedding scripts in configuration file
Open, WishlistPublicFEATURE REQUEST

Description

Certain feature sets allow running custom scripts on the local VyOS machine. For example: The high-availability feature, or specifically the transition scripts, allow running scripts when e.g. a failover occurs. (see https://docs.vyos.io/en/sagitta/configuration/highavailability/index.html#transition-scripts)

I'd have the use-case to use such feature, however trying to avoid it at all costs as these scripts are not persisted inside the configuration file.

Above suggestions could be persisted as base64 in the configuration file and re-written to disk when restored. Commands could be designed to not be a breaking change.

This feature request is about allowing:

  1. directly specifying one-liner commands as the command to run on these events

Example:

set high-availability vrrp group foo transition-script master "restart service frr && set nat source rule 100 source address '192.0.2.2/24'"

If the first part is not a file (which it usually is), the transition script is considered a command. If it is a file path, it remains with current behavior.

  1. allow saving entire configuration files in the config

Example:

set high-availability vrrp group foo transition-script master file

or

set high-availability vrrp group foo transition-script master file "transition-master.sh"

Which is then opened in a editor like "nano" for interactively editing the script everything when running.

  1. allow saving entire configuration files in the config via automation

Example:

set high-availability vrrp group foo transition-script master base64 "[...]"

Which is then decoded and used accordingly. This is useful for automation to e.g. change scripts dynamically.

Details

Difficulty level
Unknown (require assessment)
Version
-
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Feature (new functionality)

Event Timeline

Viacheslav triaged this task as Wishlist priority.Jun 26 2024, 6:55 AM

Hi all.

Any feedback about if the syntax is fine?
Or if using commands or using files should be split in separate feature requests?
Or if implementation in 1.4 is possible?

If we agree on how it should work like, I could give it a try preparing work or implementing it. If so, on which code base it should be implemented? In master branch of 1.5 and then backported to 1.4?