summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNicolas Vollmar <nvo@scaling.ch>2024-09-24 18:27:29 +0200
committerChristian Breunig <christian@breunig.cc>2024-09-24 18:29:23 +0200
commitc196c6d9207ef112e478f44923b2d0bc8a15b3c9 (patch)
tree86a66edb5857a4e87cb2c9e9df6cf58083300cb6 /src
parent26a9203e95e79afed725cc3bd1f401ae3ffa3707 (diff)
downloadvyos-1x-c196c6d9207ef112e478f44923b2d0bc8a15b3c9.tar.gz
vyos-1x-c196c6d9207ef112e478f44923b2d0bc8a15b3c9.zip
syslog: T6719: fix the behavior of "syslog global preserve-fqdn"
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/system_syslog.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/conf_mode/system_syslog.py b/src/conf_mode/system_syslog.py
index 2497c5bb6..eb2f02eb3 100755
--- a/src/conf_mode/system_syslog.py
+++ b/src/conf_mode/system_syslog.py
@@ -53,6 +53,17 @@ def get_config(config=None):
if syslog.from_defaults(['global']):
del syslog['global']
+ if (
+ 'global' in syslog
+ and 'preserve_fqdn' in syslog['global']
+ and conf.exists(['system', 'host-name'])
+ and conf.exists(['system', 'domain-name'])
+ ):
+ hostname = conf.return_value(['system', 'host-name'])
+ domain = conf.return_value(['system', 'domain-name'])
+ fqdn = f'{hostname}.{domain}'
+ syslog['global']['local_host_name'] = fqdn
+
return syslog
def verify(syslog):