diff options
| -rw-r--r-- | op-mode-definitions/configure.xml.in | 7 | ||||
| -rw-r--r-- | python/vyos/util.py | 13 | ||||
| -rwxr-xr-x | src/op_mode/powerctrl.py | 3 | 
3 files changed, 21 insertions, 2 deletions
| diff --git a/op-mode-definitions/configure.xml.in b/op-mode-definitions/configure.xml.in index 3dd5a0f45..a711fa4a9 100644 --- a/op-mode-definitions/configure.xml.in +++ b/op-mode-definitions/configure.xml.in @@ -11,7 +11,12 @@          echo "Please do it as an administrator level VyOS user instead."      else          if grep -q -e '^overlay.*/filesystem.squashfs' /proc/mounts; then -            echo "WARNING: You are currently configuring a live-ISO environment, changes will not persist until installed" +        echo "WARNING: You are currently configuring a live-ISO environment, changes will not persist until installed" +        else +            if grep -q -s '1' /tmp/vyos-config-status; then +            echo "WARNING: There was a config error on boot: saving the configuration now could overwrite data." +            echo "You may want to check and reload the boot config" +            fi          fi          history -w          export _OFR_CONFIGURE=ok diff --git a/python/vyos/util.py b/python/vyos/util.py index e62f9d5cf..33da5da40 100644 --- a/python/vyos/util.py +++ b/python/vyos/util.py @@ -1139,6 +1139,19 @@ def boot_configuration_complete() -> bool:          return True      return False +def boot_configuration_success() -> bool: +    from vyos.defaults import config_status + +    try: +        with open(config_status) as f: +            res = f.read().strip() +    except FileNotFoundError: +        return False + +    if int(res) == 0: +        return True +    return False +  def sysctl_read(name):      """ Read and return current value of sysctl() option """      tmp = cmd(f'sysctl {name}') diff --git a/src/op_mode/powerctrl.py b/src/op_mode/powerctrl.py index 239f766fd..dfacd45c2 100755 --- a/src/op_mode/powerctrl.py +++ b/src/op_mode/powerctrl.py @@ -104,8 +104,9 @@ def cancel_shutdown():  def check_unsaved_config():      from vyos.config_mgmt import unsaved_commits +    from vyos.util import boot_configuration_success -    if unsaved_commits(): +    if unsaved_commits() and boot_configuration_success():          print("Warning: there are unsaved configuration changes!")          print("Run 'save' command if you do not want to lose those changes after reboot/shutdown.")      else: | 
