feat: improve config backup and update and revert (#737)
Some checks failed
docker-build / platform-excludes (push) Has been cancelled
docker-build / build (push) Has been cancelled
docker-build / merge (push) Has been cancelled
pre-commit / pre-commit (push) Has been cancelled
Run Pytest on Pull Request / test (push) Has been cancelled

Improve the backup of the EOS configuration on configuration migration
from another version. Backup files now get a backup id based on date
and time.

Add the configuration backup listing and the revert to the backup to
the EOS api.

Add revert to backup to the EOSdash admin tab.

Improve documentation about install, update and revert of EOS versions.

Add EOS execution profiling to make commands and to test description in
the development guideline.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
This commit is contained in:
Bobby Noelte
2025-11-03 17:40:25 +01:00
committed by GitHub
parent 3432116845
commit 94c4ee2951
14 changed files with 707 additions and 170 deletions

View File

@@ -639,6 +639,42 @@ def fastapi_config_reset_post() -> ConfigEOS:
return config_eos
@app.get("/v1/config/backup", tags=["config"])
def fastapi_config_backup_get() -> dict[str, dict[str, Any]]:
"""Get the EOS configuration backup identifiers and backup metadata.
Returns:
dict[str, dict[str, Any]]: Mapping of backup identifiers to metadata.
"""
try:
result = config_eos.list_backups()
except Exception as e:
raise HTTPException(
status_code=404,
detail=f"Can not list configuration backups: {e}",
)
return result
@app.put("/v1/config/revert", tags=["config"])
def fastapi_config_revert_put(
backup_id: str = Query(..., description="EOS configuration backup ID."),
) -> ConfigEOS:
"""Revert the configuration to a EOS configuration backup.
Returns:
configuration (ConfigEOS): The current configuration after revert.
"""
try:
config_eos.revert_settings(backup_id)
except Exception as e:
raise HTTPException(
status_code=400,
detail=f"Error on reverting of configuration: {e}",
)
return config_eos
@app.put("/v1/config/file", tags=["config"])
def fastapi_config_file_put() -> ConfigEOS:
"""Save the current configuration to the EOS configuration file.