Skip to content

Commit b1a47e7

Browse files
authored
Merge pull request #4775 from jestabro/first-boot-archive-config-file
T7907: archive config file on first boot to avoid misleading log entry
2 parents 238a6bc + ad5452c commit b1a47e7

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

python/vyos/config_mgmt.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
from vyos.utils.process import is_systemd_service_active
4848
from vyos.utils.process import rc_cmd
4949
from vyos.defaults import DEFAULT_COMMIT_CONFIRM_MINUTES
50+
from vyos.component_version import append_system_version
5051

5152
SAVE_CONFIG = '/usr/libexec/vyos/vyos-save-config.py'
5253
config_json = '/run/vyatta/config/config.json'
@@ -609,14 +610,16 @@ def _add_logrotate_conf(self):
609610
conf_file.chmod(0o644)
610611

611612
def _archive_active_config(self) -> bool:
612-
save_to_tmp = boot_configuration_complete() or not os.path.isfile(
613-
archive_config_file
614-
)
613+
# on first boot/fresh install, add baseline archive_config_file
614+
if not os.path.exists(archive_config_file):
615+
append_system_version(archive_config_file)
616+
615617
mask = os.umask(0o113)
616618

617619
ext = os.getpid()
618620
cmp_saved = f'/tmp/config.boot.{ext}'
619-
if save_to_tmp:
621+
622+
if boot_configuration_complete():
620623
save_config(cmp_saved, json_out=config_json)
621624
else:
622625
copy(config_file, cmp_saved)

0 commit comments

Comments
 (0)