summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2023-05-12 06:07:07 +0300
committerGitHub <noreply@github.com>2023-05-12 06:07:07 +0300
commit0b85c416525eae06974763043bab4b0ec706c445 (patch)
tree8558263dede522d542d65eceddd088d9b1fd87ae /src/conf_mode
parent7ccd7b4ab990c5501069af7af5d6929abf5b4f11 (diff)
parentbdc9e293a9acb6265b7c0f75a965da801e797574 (diff)
downloadvyos-1x-0b85c416525eae06974763043bab4b0ec706c445.tar.gz
vyos-1x-0b85c416525eae06974763043bab4b0ec706c445.zip
Merge pull request #2001 from c-po/t2769-syslog-vrf-backport1.3.3
syslog: T2769: add VRF support (backport)
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/system-syslog.py29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/conf_mode/system-syslog.py b/src/conf_mode/system-syslog.py
index 3d8a51cd8..030192ec2 100755
--- a/src/conf_mode/system-syslog.py
+++ b/src/conf_mode/system-syslog.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2018-2020 VyOS maintainers and contributors
+# Copyright (C) 2018-2023 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -20,8 +20,11 @@ import re
from sys import exit
from vyos.config import Config
+from vyos.configdict import is_node_changed
+from vyos.configverify import verify_vrf
from vyos import ConfigError
from vyos.util import run
+from vyos.util import call
from vyos.template import render
from vyos import airbag
@@ -38,9 +41,9 @@ def get_config(config=None):
config_data = {
'files': {},
- 'console': {},
- 'hosts': {},
- 'user': {}
+ 'console': {},
+ 'hosts': {},
+ 'user': {}
}
#
@@ -80,7 +83,6 @@ def get_config(config=None):
#
# set system syslog file
#
-
if c.exists('file'):
filenames = c.list_nodes('file')
for filename in filenames:
@@ -164,6 +166,9 @@ def get_config(config=None):
}
)
+ if c.exists('vrf'):
+ config_data.update({'vrf' : c.return_value('vrf')})
+
return config_data
@@ -210,6 +215,11 @@ def generate(c):
conf = '/etc/logrotate.d/vyos-rsyslog'
render(conf, 'syslog/logrotate.tmpl', c)
+ conf = r'/etc/systemd/system/rsyslog.service.d/override.conf'
+ render(conf, 'syslog/override.conf.tmpl', c)
+
+ # Reload systemd manager configuration
+ call('systemctl daemon-reload')
def verify(c):
if c == None:
@@ -221,8 +231,11 @@ def verify(c):
#
if not os.path.islink('/etc/rsyslog.conf'):
os.remove('/etc/rsyslog.conf')
- os.symlink(
- '/usr/share/vyos/templates/rsyslog/rsyslog.conf', '/etc/rsyslog.conf')
+ os.symlink('/usr/share/vyos/templates/rsyslog/rsyslog.conf',
+ '/etc/rsyslog.conf')
+
+
+ verify_vrf(c)
# /var/log/vyos-rsyslog were the old files, we may want to clean those up, but currently there
# is a chance that someone still needs it, so I don't automatically remove
@@ -240,6 +253,8 @@ def verify(c):
for conf in c:
if c[conf]:
+ if conf == 'vrf':
+ continue
for item in c[conf]:
for s in c[conf][item]['selectors'].split(";"):
f = re.sub("\..*$", "", s)