summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhagbard <vyosdev@derith.de>2019-03-11 14:59:50 -0700
committerhagbard <vyosdev@derith.de>2019-03-11 14:59:50 -0700
commitdf6999ecf8dcae9656a98fe92725a611e400b435 (patch)
tree3963bcad136c63e3ec9f1b66ee1fa8cbf2478428
parent49a7c14a815d25dbd46cdbc09dfce2a4dfaeed3e (diff)
downloadvyos-1x-df6999ecf8dcae9656a98fe92725a611e400b435.tar.gz
vyos-1x-df6999ecf8dcae9656a98fe92725a611e400b435.zip
[rsyslog] Fixes: T1294 - Trying to delete 'system syslog' throws an exception
-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: