From ad5452c19e73f043d3f227843871bf3ae3811348 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Fri, 3 Oct 2025 11:37:38 -0500 Subject: 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. --- python/vyos/config_mgmt.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'python') 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) -- cgit v1.2.3