summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-06-22 19:18:46 +0200
committerGitHub <noreply@github.com>2024-06-22 19:18:46 +0200
commitf1ac0b57af6ac74f084e7946d165812427705427 (patch)
treee092ee10d77ce7018ced3d245f1a8098608e25f1 /python
parent544e606af3fb92d3a49d4b9ee6fd1910b457132f (diff)
parent5e88f15b16d39213f349c3a7b4f1030a1399f1cb (diff)
downloadvyos-1x-f1ac0b57af6ac74f084e7946d165812427705427.tar.gz
vyos-1x-f1ac0b57af6ac74f084e7946d165812427705427.zip
Merge pull request #3697 from vyos/mergify/bp/circinus-stream/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.py4
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)