summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2025-10-03 11:37:38 -0500
committerJohn Estabrook <jestabro@vyos.io>2025-10-03 11:45:20 -0500
commitad5452c19e73f043d3f227843871bf3ae3811348 (patch)
treed302f6b795ac756f08c392c3c5fed17e68a70cbf /python
parent714248a44dff73ecf6e51a905e1837a67b784aa5 (diff)
downloadvyos-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.py11
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)