diff options
| author | Christian Breunig <christian@breunig.cc> | 2025-09-30 21:16:04 +0200 |
|---|---|---|
| committer | Christian Breunig <christian@breunig.cc> | 2025-09-30 21:20:44 +0200 |
| commit | defc29ef4d42224fbea591fc2909d83e7904c20e (patch) | |
| tree | 06de6ecc4c38c86d1750ce51a962d3421198c71e /src | |
| parent | 5845c4b1c50bc0335284cfb3306e0a91de3efd40 (diff) | |
| download | vyos-1x-defc29ef4d42224fbea591fc2909d83e7904c20e.tar.gz vyos-1x-defc29ef4d42224fbea591fc2909d83e7904c20e.zip | |
boot-config-loader: T7889: Inform user during login of config-load issues
As T7885 turns out to be a config load related bug the user will only be
informed when entering conf mode that something is off.
vyos@vyos:~$ configure
WARNING: There was a config error on boot: saving the configuration now could overwrite data.
You may want to check and reload the boot config
More information is displayed on tty0 of the router - but not everyone has
access to tty0. This change is about copying the message displayed on tty0 to
the MOTD system.
Diffstat (limited to 'src')
| -rwxr-xr-x | src/helpers/vyos-boot-config-loader.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/helpers/vyos-boot-config-loader.py b/src/helpers/vyos-boot-config-loader.py index e20b8415f..9826a6d3e 100755 --- a/src/helpers/vyos-boot-config-loader.py +++ b/src/helpers/vyos-boot-config-loader.py @@ -13,8 +13,6 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -# -# import os import sys @@ -23,10 +21,13 @@ import grp import traceback from datetime import datetime -from vyos.defaults import directories, config_status -from vyos.configsession import ConfigSession, ConfigSessionError +from vyos.defaults import directories +from vyos.defaults import config_status +from vyos.configsession import ConfigSession +from vyos.configsession import ConfigSessionError from vyos.configtree import ConfigTree from vyos.utils.process import cmd +from vyos.utils.file import write_file STATUS_FILE = config_status TRACE_FILE = '/tmp/boot-config-trace' @@ -68,16 +69,16 @@ def trace_to_file(trace_file_name): print('{0}'.format(e)) def failsafe(config_file_name): - fail_msg = """ + fail_msg = f""" !!!!! There were errors loading the configuration - Please examine the errors in - {0} - and correct + Please examine the errors in: + {TRACE_FILE} !!!!! - """.format(TRACE_FILE) + """ print(fail_msg, file=sys.stderr) + write_file('/run/motd.d/9999-boot-config-error', fail_msg) users = [x[0] for x in pwd.getpwall()] if 'vyos' in users: |
