Page MenuHomeVyOS Platform

node.def generator should automatically add default values
Closed, ResolvedPublicFEATURE REQUEST

Assigned To
Authored By
c-po
Feb 24 2022, 6:16 PM
Referenced Files
F2462503: image.png
Feb 24 2022, 7:26 PM
F2462501: image.png
Feb 24 2022, 7:25 PM
F2462499: image.png
Feb 24 2022, 7:24 PM
F2462497: image.png
Feb 24 2022, 7:11 PM

Description

Since introducing the XML <defaultValue> node it was common, but redundant, practice to also add a help string indicating which value would be used as default if the node is unset.

This makes no sense b/c it's duplicated code/value/characters and prone to error. The node.def scripts should be extended to automatically render the appropriate default value into the CLI help string.

For e.g. SSH the current PoC renders:

(20:08) cpo lnx01:~/vyos-1x [current] # cat templates-cfg/service/ssh/port/node.def
multi:
type: txt
help: Port for SSH service (default: 22)
val_help: u32:1-65535; Numeric IP port
syntax:expression: exec "${vyos_libexec_dir}/validate-value  --exec \"${vyos_validators_dir}/numeric --range 1-65535\"  --value \'$VAR(@)\'"; "Invalid value"

Not all subsystems are already migrated to get_config_dict() and make use of the defaults() call - those subsystems need to be migrated, first

Sections highlighted in yellow are auto generated

image.png (844×874 px, 62 KB)

Details

Difficulty level
Hard (possibly days)
Version
1.4
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Improvement (missing useful functionality)

Event Timeline

c-po created this task.
c-po changed Difficulty level from Unknown (require assessment) to Hard (possibly days).
c-po changed Version from - to 1.4.
c-po changed Is it a breaking change? from Unspecified (possibly destroys the router) to Perfectly compatible.
c-po changed Issue type from Unspecified (please specify) to Improvement (missing useful functionality).
c-po updated the task description. (Show Details)
c-po updated the task description. (Show Details)
c-po updated the task description. (Show Details)
c-po triaged this task as Wishlist priority.
c-po reopened this task as Backport pending.Oct 8 2023, 8:07 AM
c-po moved this task from Need Triage to Finished on the VyOS 1.4 Sagitta board.