diff options
author | Daniil Baturin <daniil@vyos.io> | 2024-06-22 17:27:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-22 17:27:04 +0200 |
commit | f9c45bb95dfee33fe15f3db280e1e24bcdf34002 (patch) | |
tree | f0ec7d063d7dea17169cb58a9078ebed9e4857db /python | |
parent | 5d46c64a3041504a81e630790a88738300b232c1 (diff) | |
parent | e5bb0529da6cd932878e4f2bde4025bc48a93f23 (diff) | |
download | vyos-1x-f9c45bb95dfee33fe15f3db280e1e24bcdf34002.tar.gz vyos-1x-f9c45bb95dfee33fe15f3db280e1e24bcdf34002.zip |
Merge pull request #3695 from vyos/mergify/bp/sagitta/pr-3654
op-mode: T5514: Allow safe reboots to config defaults when config.boot is deleted (backport #3654)
Diffstat (limited to 'python')
-rw-r--r-- | python/vyos/config_mgmt.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/python/vyos/config_mgmt.py b/python/vyos/config_mgmt.py index 70b6ea203..d518737ca 100644 --- a/python/vyos/config_mgmt.py +++ b/python/vyos/config_mgmt.py @@ -81,9 +81,11 @@ def save_config(target, json_out=None): if rc != 0: logger.critical(f'save config failed: {out}') -def unsaved_commits() -> bool: +def unsaved_commits(allow_missing_config=False) -> bool: if get_full_version_data()['boot_via'] == 'livecd': return False + if allow_missing_config and not os.path.exists(config_file): + return True tmp_save = '/tmp/config.running' save_config(tmp_save) ret = not cmp(tmp_save, config_file, shallow=False) |