Page MenuHomeVyOS Platform

Ability to export the current configuration in JSON format
Closed, ResolvedPublicFEATURE REQUEST

Description

Ability to have the current configuration in JSON format.
For example, per commit, it should save the configuration to some file like /run/vyos/config/current-config.json

The use case is to use custom scripts for parsing configuration (10K requests per several seconds)

Details

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

Event Timeline

Based on the requirements, it is natural to add this to the commit_revision post-commit hook of the config_mgmt module: this is low overhead as we use the existing configtree representation of the current config to save with ConfigTree().to_json().

Note that we are writing output to /run/vyatta/config/config.json, as a convenience, since the /run/vyatta dir is already created with correct permissions in:
https://github.com/vyos/vyos-1x/blob/current/src/init/vyos-router#L332-L334

One could just as easily add a /run/vyos directory with group owner 'vyattacfg' at that point, although eventually the translation 'vyatta' -> 'vyos' will take place as remaining legacy code is removed.

The PR below will handle Circinus and mergify to Sagitta; backporting to Equuleus would require a standalone post-commit hook, unless one considers backporting the config_mgmt module and vyos-save-config.py.

https://github.com/vyos/vyos-1x/pull/2339

jestabro changed the task status from Open to In progress.Oct 5 2023, 5:12 AM
jestabro triaged this task as Normal priority.
jestabro changed Difficulty level from Unknown (require assessment) to Normal (likely a few hours).
jestabro changed Is it a breaking change? from Unspecified (possibly destroys the router) to Perfectly compatible.
jestabro changed the task status from In progress to Backport candidate.Oct 5 2023, 5:41 PM
jestabro moved this task from Need Triage to Finished on the VyOS 1.4 Sagitta board.

Added for 1.4, 1.5; as mentioned above, a backport to Equuleus will require a different implementation.

dmbaturin renamed this task from Ability to have the current configuration in JSON format to Ability to export the current configuration in JSON format.Fri, Apr 12, 2:34 PM
dmbaturin closed this task as Resolved.