From 780d4fe16cd8471ca4fd27ba43fea998ef0240f0 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 1 May 2022 20:38:04 +0200 Subject: syslog: T4353: fix Jinja2 linting errors --- data/templates/syslog/logrotate.j2 | 11 +++++++ data/templates/syslog/logrotate.tmpl | 11 ------- data/templates/syslog/rsyslog.conf.j2 | 54 +++++++++++++++++++++++++++++++++ data/templates/syslog/rsyslog.conf.tmpl | 54 --------------------------------- 4 files changed, 65 insertions(+), 65 deletions(-) create mode 100644 data/templates/syslog/logrotate.j2 delete mode 100644 data/templates/syslog/logrotate.tmpl create mode 100644 data/templates/syslog/rsyslog.conf.j2 delete mode 100644 data/templates/syslog/rsyslog.conf.tmpl (limited to 'data/templates') diff --git a/data/templates/syslog/logrotate.j2 b/data/templates/syslog/logrotate.j2 new file mode 100644 index 000000000..c1b951e8b --- /dev/null +++ b/data/templates/syslog/logrotate.j2 @@ -0,0 +1,11 @@ +{{ config_render['log-file'] }} { + missingok + notifempty + create + rotate {{ config_render['max-files'] }} + size={{ config_render['max-size'] // 1024 }}k + postrotate + invoke-rc.d rsyslog rotate > /dev/null + endscript +} + diff --git a/data/templates/syslog/logrotate.tmpl b/data/templates/syslog/logrotate.tmpl deleted file mode 100644 index c1b951e8b..000000000 --- a/data/templates/syslog/logrotate.tmpl +++ /dev/null @@ -1,11 +0,0 @@ -{{ config_render['log-file'] }} { - missingok - notifempty - create - rotate {{ config_render['max-files'] }} - size={{ config_render['max-size'] // 1024 }}k - postrotate - invoke-rc.d rsyslog rotate > /dev/null - endscript -} - diff --git a/data/templates/syslog/rsyslog.conf.j2 b/data/templates/syslog/rsyslog.conf.j2 new file mode 100644 index 000000000..4445d568b --- /dev/null +++ b/data/templates/syslog/rsyslog.conf.j2 @@ -0,0 +1,54 @@ +## generated by syslog.py ## +## file based logging +{% if files['global']['marker'] %} +$ModLoad immark +{% if files['global']['marker-interval'] %} +$MarkMessagePeriod {{ files['global']['marker-interval'] }} +{% endif %} +{% endif %} +{% if files['global']['preserver_fqdn'] %} +$PreserveFQDN on +{% endif %} +{% for file, file_options in files.items() %} +$outchannel {{ file }},{{ file_options['log-file'] }},{{ file_options['max-size'] }},{{ file_options['action-on-max-size'] }} +{{ file_options['selectors'] }} :omfile:${{ file }} +{% endfor %} +{% if console is defined and console is not none %} +## console logging +{% for con, con_options in console.items() %} +{{ con_options['selectors'] }} /dev/console +{% endfor %} +{% endif %} +{% if hosts is defined and hosts is not none %} +## remote logging +{% for host, host_options in hosts.items() %} +{% if host_options.proto == 'tcp' %} +{% if host_options.port is defined %} +{% if host_options.oct_count is defined %} +{{ host_options.selectors }} @@(o){{ host | bracketize_ipv6 }}:{{ host_options.port }};RSYSLOG_SyslogProtocol23Format +{% else %} +{{ host_options.selectors }} @@{{ host | bracketize_ipv6 }}:{{ host_options.port }} +{% endif %} +{% else %} +{{ host_options.selectors }} @@{{ host | bracketize_ipv6 }} +{% endif %} +{% elif host_options.proto == 'udp' %} +{% if host_options.port is defined %} +{{ host_options.selectors }} @{{ host | bracketize_ipv6 }}:{{ host_options.port }}{{ ';RSYSLOG_SyslogProtocol23Format' if host_options.oct_count is sameas true }} +{% else %} +{{ host_options.selectors }} @{{ host | bracketize_ipv6 }} +{% endif %} +{% else %} +{% if host_options['port'] %} +{{ host_options.selectors }} @{{ host | bracketize_ipv6 }}:{{ host_options.port }} +{% else %} +{{ host_options.selectors }} @{{ host | bracketize_ipv6 }} +{% endif %} +{% endif %} +{% endfor %} +{% endif %} +{% if user is defined and user is not none %} +{% for username, user_options in user.items() %} +{{ user_options.selectors }} :omusrmsg:{{ username }} +{% endfor %} +{% endif %} diff --git a/data/templates/syslog/rsyslog.conf.tmpl b/data/templates/syslog/rsyslog.conf.tmpl deleted file mode 100644 index 2fb621760..000000000 --- a/data/templates/syslog/rsyslog.conf.tmpl +++ /dev/null @@ -1,54 +0,0 @@ -## generated by syslog.py ## -## file based logging -{% if files['global']['marker'] %} -$ModLoad immark -{% if files['global']['marker-interval'] %} -$MarkMessagePeriod {{files['global']['marker-interval']}} -{% endif %} -{% endif %} -{% if files['global']['preserver_fqdn'] %} -$PreserveFQDN on -{% endif %} -{% for file, file_options in files.items() %} -$outchannel {{ file }},{{ file_options['log-file'] }},{{ file_options['max-size'] }},{{ file_options['action-on-max-size'] }} -{{ file_options['selectors'] }} :omfile:${{ file }} -{% endfor %} -{% if console is defined and console is not none %} -## console logging -{% for con, con_options in console.items() %} -{{ con_options['selectors'] }} /dev/console -{% endfor %} -{% endif %} -{% if hosts is defined and hosts is not none %} -## remote logging -{% for host, host_options in hosts.items() %} -{% if host_options.proto == 'tcp' %} -{% if host_options.port is defined %} -{% if host_options.oct_count is defined %} -{{ host_options.selectors }} @@(o){{ host | bracketize_ipv6 }}:{{ host_options.port }};RSYSLOG_SyslogProtocol23Format -{% else %} -{{ host_options.selectors }} @@{{ host | bracketize_ipv6 }}:{{ host_options.port }} -{% endif %} -{% else %} -{{ host_options.selectors }} @@{{ host | bracketize_ipv6 }} -{% endif %} -{% elif host_options.proto == 'udp' %} -{% if host_options.port is defined %} -{{ host_options.selectors }} @{{ host | bracketize_ipv6 }}:{{ host_options.port }}{{ ';RSYSLOG_SyslogProtocol23Format' if host_options.oct_count is sameas true }} -{% else %} -{{ host_options.selectors }} @{{ host | bracketize_ipv6 }} -{% endif %} -{% else %} -{% if host_options['port'] %} -{{ host_options.selectors }} @{{ host | bracketize_ipv6 }}:{{ host_options.port }} -{% else %} -{{ host_options.selectors }} @{{ host | bracketize_ipv6 }} -{% endif %} -{% endif %} -{% endfor %} -{% endif %} -{% if user is defined and user is not none %} -{% for username, user_options in user.items() %} -{{ user_options.selectors }} :omusrmsg:{{ username }} -{% endfor %} -{% endif %} -- cgit v1.2.3