diff options
| author | John Estabrook <jestabro@vyos.io> | 2025-10-03 11:37:38 -0500 |
|---|---|---|
| committer | John Estabrook <jestabro@vyos.io> | 2025-10-03 11:45:20 -0500 |
| commit | ad5452c19e73f043d3f227843871bf3ae3811348 (patch) | |
| tree | d302f6b795ac756f08c392c3c5fed17e68a70cbf /python | |
| parent | 714248a44dff73ecf6e51a905e1837a67b784aa5 (diff) | |
| download | vyos-1x-ad5452c19e73f043d3f227843871bf3ae3811348.tar.gz vyos-1x-ad5452c19e73f043d3f227843871bf3ae3811348.zip | |
T7907: archive config file on first boot to avoid misleading log entry
Restrictions on writing an empty config file in T7709 lead to a
misleading log entry on first boot, in the absence of a baseline
archived config file; explicitly create.
Diffstat (limited to 'python')
| -rw-r--r-- | python/vyos/config_mgmt.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/python/vyos/config_mgmt.py b/python/vyos/config_mgmt.py index b549b3005..0dbfcc504 100644 --- a/python/vyos/config_mgmt.py +++ b/python/vyos/config_mgmt.py @@ -47,6 +47,7 @@ from vyos.utils.boot import boot_configuration_complete from vyos.utils.process import is_systemd_service_active from vyos.utils.process import rc_cmd from vyos.defaults import DEFAULT_COMMIT_CONFIRM_MINUTES +from vyos.component_version import append_system_version SAVE_CONFIG = '/usr/libexec/vyos/vyos-save-config.py' config_json = '/run/vyatta/config/config.json' @@ -609,14 +610,16 @@ Proceed ?""" conf_file.chmod(0o644) def _archive_active_config(self) -> bool: - save_to_tmp = boot_configuration_complete() or not os.path.isfile( - archive_config_file - ) + # on first boot/fresh install, add baseline archive_config_file + if not os.path.exists(archive_config_file): + append_system_version(archive_config_file) + mask = os.umask(0o113) ext = os.getpid() cmp_saved = f'/tmp/config.boot.{ext}' - if save_to_tmp: + + if boot_configuration_complete(): save_config(cmp_saved, json_out=config_json) else: copy(config_file, cmp_saved) |
