summaryrefslogtreecommitdiff
path: root/src/conf_mode/syslog.py
diff options
context:
space:
mode:
authorhagbard <vyosdev@derith.de>2019-03-11 14:59:50 -0700
committerDaniil Baturin <daniil@baturin.org>2019-05-26 15:13:53 +0200
commit4d54708384bf9dc862fef5d35d4bbc4b9200bd86 (patch)
tree9083b883686f56835a146d3723ffbf369ae9edf8 /src/conf_mode/syslog.py
parent175610cd81c2bb2dfd9af9a62b7cc30ad25c9c79 (diff)
downloadvyos-1x-4d54708384bf9dc862fef5d35d4bbc4b9200bd86.tar.gz
vyos-1x-4d54708384bf9dc862fef5d35d4bbc4b9200bd86.zip
[rsyslog] Fixes: T1294 - Trying to delete 'system syslog' throws an exception
Diffstat (limited to 'src/conf_mode/syslog.py')
-rwxr-xr-xsrc/conf_mode/syslog.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/conf_mode/syslog.py b/src/conf_mode/syslog.py
index e726a5755..d600146f3 100755
--- a/src/conf_mode/syslog.py
+++ b/src/conf_mode/syslog.py
@@ -231,6 +231,9 @@ def generate_selectors(c, config_node):
return selectors
def generate(c):
+ if c == None:
+ return None
+
tmpl = jinja2.Template(configs, trim_blocks=True)
config_text = tmpl.render(c)
with open('/etc/rsyslog.d/vyos-rsyslog.conf', 'w') as f:
@@ -243,11 +246,12 @@ def generate(c):
f.write(config_text)
def verify(c):
+ if c == None:
+ return None
#
# /etc/rsyslog.conf is generated somewhere and copied over the original (exists in /opt/vyatta/etc/rsyslog.conf)
# it interferes with the global logging, to make sure we are using a single base, template is enforced here
#
-
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')
@@ -277,10 +281,16 @@ def verify(c):
def apply(c):
### vyatta-log.conf is being generated somewhere
### this is just a quick hack to remove the old configfile
-
- if os.path.exists('/etc/rsyslog.d/vyatta-log.conf'):
- os.remove('/etc/rsyslog.d/vyatta-log.conf')
- os.system("sudo systemctl restart rsyslog >/dev/null")
+
+ if c == None:
+ ### systemd restarts it, using kill
+ #os.system("sudo systemctl stop rsyslog >/dev/null 2>&1")
+ print ("systemd sends messages to rsyslog, rsyslog won't be stopped")
+ else:
+ if os.path.exists('/etc/rsyslog.d/vyatta-log.conf'):
+ os.remove('/etc/rsyslog.d/vyatta-log.conf')
+
+ os.system("sudo systemctl restart rsyslog >/dev/null")
if __name__ == '__main__':
try: