summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-03-04 22:12:40 +0100
committerChristian Poessinger <christian@poessinger.com>2020-03-04 22:12:40 +0100
commit28ff7570f117f80bdd1f7c3a80eb8153fc368373 (patch)
tree6e2968f669bb06bb2aa8dd8db85fe34f497036dd /src
parent10ef1bb6c4a8e02081660eddf5918c92151382b7 (diff)
downloadvyos-1x-28ff7570f117f80bdd1f7c3a80eb8153fc368373.tar.gz
vyos-1x-28ff7570f117f80bdd1f7c3a80eb8153fc368373.zip
banner: T2099: accept empty pre-/post-login banner
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/system-login-banner.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/conf_mode/system-login-banner.py b/src/conf_mode/system-login-banner.py
index e66d409bb..20cc16f97 100755
--- a/src/conf_mode/system-login-banner.py
+++ b/src/conf_mode/system-login-banner.py
@@ -16,6 +16,7 @@
from sys import exit
from vyos.config import Config
+from vyos import ConfigError
motd="""
The programs included with the Debian GNU/Linux system are free software;
@@ -49,15 +50,25 @@ def get_config():
# Post-Login banner
if conf.exists(['post-login']):
tmp = conf.return_value(['post-login'])
- tmp = tmp.replace('\\n','\n')
- tmp = tmp.replace('\\t','\t')
+ # post-login banner can be empty as well
+ if tmp:
+ tmp = tmp.replace('\\n','\n')
+ tmp = tmp.replace('\\t','\t')
+ else:
+ tmp = ''
+
banner['motd'] = tmp
# Pre-Login banner
if conf.exists(['pre-login']):
tmp = conf.return_value(['pre-login'])
- tmp = tmp.replace('\\n','\n')
- tmp = tmp.replace('\\t','\t')
+ # pre-login banner can be empty as well
+ if tmp:
+ tmp = tmp.replace('\\n','\n')
+ tmp = tmp.replace('\\t','\t')
+ else:
+ tmp = ''
+
banner['issue'] = banner['issue_net'] = tmp
return banner