summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNicolas Vollmar <nvo@scaling.ch>2024-09-24 18:27:29 +0200
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2024-09-24 16:32:49 +0000
commitea5da8d07d1733207345ec2b736359483f25d7fb (patch)
tree49ecbfbf5144e6c8207ff44e387b304ea7fb4119 /src
parent46f83c7d09b923e99a3632b7cc153da08cdded9a (diff)
downloadvyos-1x-ea5da8d07d1733207345ec2b736359483f25d7fb.tar.gz
vyos-1x-ea5da8d07d1733207345ec2b736359483f25d7fb.zip
syslog: T6719: fix the behavior of "syslog global preserve-fqdn"mergify/bp/circinus/pr-4079
(cherry picked from commit c196c6d9207ef112e478f44923b2d0bc8a15b3c9)
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 07fbb0734..476f403bd 100755
--- a/src/conf_mode/system_syslog.py
+++ b/src/conf_mode/system_syslog.py
@@ -52,6 +52,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):