diff options
| author | Christian Breunig <christian@breunig.cc> | 2025-10-06 21:29:53 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-06 21:29:53 +0200 |
| commit | b1a47e7c6388911192a2bccca053735972a82bef (patch) | |
| tree | 6356877833e0ba62a5a7ffd8b675f4ac9d4d0690 | |
| parent | 238a6bc81bae444a6d8fa1c223d9d5a4e4aa66f7 (diff) | |
| parent | ad5452c19e73f043d3f227843871bf3ae3811348 (diff) | |
| download | vyos-1x-b1a47e7c6388911192a2bccca053735972a82bef.tar.gz vyos-1x-b1a47e7c6388911192a2bccca053735972a82bef.zip | |
Merge pull request #4775 from jestabro/first-boot-archive-config-file
T7907: archive config file on first boot to avoid misleading log entry
| -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) |
