diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-11-28 08:25:39 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-11-28 08:25:39 +0100 |
commit | c87ad948999c28c3c9449f98d60b545481ea29d5 (patch) | |
tree | 18b188cf73266be95c62f128afe5d155a7a03bf4 /src | |
parent | 41f79409c742b6a020318b196cbaa52439845d6d (diff) | |
download | vyos-1x-c87ad948999c28c3c9449f98d60b545481ea29d5.tar.gz vyos-1x-c87ad948999c28c3c9449f98d60b545481ea29d5.zip |
vyos.template: T2720: fix remaining in-line time_block syntax
Commit a2ac9fac ("vyos.template: T2720: always enable Jinja2 trim_blocks
feature") globally enabled the trim_blocks feature. Some templates still used
in-line trim_blocks "{%"- or "-%}" which caused miss-placed line endings.
This is fixed by removing all in-line trim_block statememnts of Jinja2 templates.
Diffstat (limited to 'src')
-rwxr-xr-x | src/op_mode/dynamic_dns.py | 4 | ||||
-rwxr-xr-x | src/op_mode/show_cpu.py | 20 | ||||
-rwxr-xr-x | src/op_mode/show_igmpproxy.py | 8 | ||||
-rwxr-xr-x | src/op_mode/show_nat_statistics.py | 12 | ||||
-rwxr-xr-x | src/op_mode/show_openvpn.py | 4 | ||||
-rwxr-xr-x | src/op_mode/show_usb_serial.py | 4 | ||||
-rwxr-xr-x | src/op_mode/show_vrf.py | 4 | ||||
-rwxr-xr-x | src/op_mode/snmp_v3.py | 8 |
8 files changed, 32 insertions, 32 deletions
diff --git a/src/op_mode/dynamic_dns.py b/src/op_mode/dynamic_dns.py index 021acfd73..962943896 100755 --- a/src/op_mode/dynamic_dns.py +++ b/src/op_mode/dynamic_dns.py @@ -26,13 +26,13 @@ from vyos.util import call cache_file = r'/run/ddclient/ddclient.cache' OUT_TMPL_SRC = """ -{%- for entry in hosts -%} +{% for entry in hosts %} ip address : {{ entry.ip }} host-name : {{ entry.host }} last update : {{ entry.time }} update-status: {{ entry.status }} -{% endfor -%} +{% endfor %} """ def show_status(): diff --git a/src/op_mode/show_cpu.py b/src/op_mode/show_cpu.py index 0a540da1d..0040e950d 100755 --- a/src/op_mode/show_cpu.py +++ b/src/op_mode/show_cpu.py @@ -21,16 +21,16 @@ from sys import exit from vyos.util import popen, DEVNULL OUT_TMPL_SRC = """ -{%- if cpu -%} -{% if 'vendor' in cpu %}CPU Vendor: {{cpu.vendor}}{%- endif %} -{% if 'model' in cpu %}Model: {{cpu.model}}{%- endif %} -{% if 'cpus' in cpu %}Total CPUs: {{cpu.cpus}}{%- endif %} -{% if 'sockets' in cpu %}Sockets: {{cpu.sockets}}{%- endif %} -{% if 'cores' in cpu %}Cores: {{cpu.cores}}{%- endif %} -{% if 'threads' in cpu %}Threads: {{cpu.threads}}{%- endif %} -{% if 'mhz' in cpu %}Current MHz: {{cpu.mhz}}{%- endif %} -{% if 'mhz_min' in cpu %}Minimum MHz: {{cpu.mhz_min}}{%- endif %} -{% if 'mhz_max' in cpu %}Maximum MHz: {{cpu.mhz_max}}{%- endif %} +{% if cpu %} +{% if 'vendor' in cpu %}CPU Vendor: {{cpu.vendor}}{% endif %} +{% if 'model' in cpu %}Model: {{cpu.model}}{% endif %} +{% if 'cpus' in cpu %}Total CPUs: {{cpu.cpus}}{% endif %} +{% if 'sockets' in cpu %}Sockets: {{cpu.sockets}}{% endif %} +{% if 'cores' in cpu %}Cores: {{cpu.cores}}{% endif %} +{% if 'threads' in cpu %}Threads: {{cpu.threads}}{% endif %} +{% if 'mhz' in cpu %}Current MHz: {{cpu.mhz}}{% endif %} +{% if 'mhz_min' in cpu %}Minimum MHz: {{cpu.mhz_min}}{% endif %} +{% if 'mhz_max' in cpu %}Maximum MHz: {{cpu.mhz_max}}{% endif %} {% endif %} """ diff --git a/src/op_mode/show_igmpproxy.py b/src/op_mode/show_igmpproxy.py index 5ccc16287..4714e494b 100755 --- a/src/op_mode/show_igmpproxy.py +++ b/src/op_mode/show_igmpproxy.py @@ -36,9 +36,9 @@ import vyos.config # eth0.3 0.0b 0 0.0b 0 xxx.xxx.x.7 # tun1 0.0b 0 0.0b 0 xxx.xxx.xxx.2 vif_out_tmpl = """ -{%- for r in data %} +{% for r in data %} {{ "%-10s"|format(r.interface) }} {{ "%-12s"|format(r.bytes_in) }} {{ "%-12s"|format(r.pkts_in) }} {{ "%-12s"|format(r.bytes_out) }} {{ "%-12s"|format(r.pkts_out) }} {{ "%-15s"|format(r.loc) }} -{%- endfor %} +{% endfor %} """ # Output Template for "show ip multicast mfc" command @@ -48,9 +48,9 @@ vif_out_tmpl = """ # xxx.xxx.xxx.250 xxx.xx.xxx.75 -- # xxx.xxx.xx.124 xx.xxx.xxx.26 -- mfc_out_tmpl = """ -{%- for r in data %} +{% for r in data %} {{ "%-15s"|format(r.group) }} {{ "%-15s"|format(r.origin) }} {{ "%-12s"|format(r.pkts) }} {{ "%-12s"|format(r.bytes) }} {{ "%-12s"|format(r.wrong) }} {{ "%-10s"|format(r.iif) }} {{ "%-20s"|format(r.oifs|join(', ')) }} -{%- endfor %} +{% endfor %} """ parser = argparse.ArgumentParser() diff --git a/src/op_mode/show_nat_statistics.py b/src/op_mode/show_nat_statistics.py index 0b53112f2..482993d06 100755 --- a/src/op_mode/show_nat_statistics.py +++ b/src/op_mode/show_nat_statistics.py @@ -26,14 +26,14 @@ OUT_TMPL_SRC=""" rule pkts bytes interface ---- ---- ----- --------- {% for r in output %} -{%- if r.comment -%} -{%- set packets = r.counter.packets -%} -{%- set bytes = r.counter.bytes -%} -{%- set interface = r.interface -%} +{% if r.comment %} +{% set packets = r.counter.packets %} +{% set bytes = r.counter.bytes %} +{% set interface = r.interface %} {# remove rule comment prefix #} -{%- set comment = r.comment | replace('SRC-NAT-', '') | replace('DST-NAT-', '') | replace(' tcp_udp', '') -%} +{% set comment = r.comment | replace('SRC-NAT-', '') | replace('DST-NAT-', '') | replace(' tcp_udp', '') %} {{ "%-4s" | format(comment) }} {{ "%9s" | format(packets) }} {{ "%12s" | format(bytes) }} {{ interface }} -{%- endif %} +{% endif %} {% endfor %} """ diff --git a/src/op_mode/show_openvpn.py b/src/op_mode/show_openvpn.py index 1da4c7ecb..f7b99cc0d 100755 --- a/src/op_mode/show_openvpn.py +++ b/src/op_mode/show_openvpn.py @@ -28,9 +28,9 @@ OpenVPN status on {{ intf }} Client CN Remote Host Local Host TX bytes RX bytes Connected Since --------- ----------- ---------- -------- -------- --------------- -{%- for c in clients %} +{% for c in clients %} {{ "%-15s"|format(c.name) }} {{ "%-21s"|format(c.remote) }} {{ "%-21s"|format(local) }} {{ "%-9s"|format(c.tx_bytes) }} {{ "%-9s"|format(c.rx_bytes) }} {{ c.online_since }} -{%- endfor %} +{% endfor %} {% endif %} """ diff --git a/src/op_mode/show_usb_serial.py b/src/op_mode/show_usb_serial.py index 776898c25..973bf19c8 100755 --- a/src/op_mode/show_usb_serial.py +++ b/src/op_mode/show_usb_serial.py @@ -22,9 +22,9 @@ from sys import exit OUT_TMPL_SRC = """Device Model Vendor ------ ------ ------ -{%- for d in devices %} +{% for d in devices %} {{ "%-16s" | format(d.device) }} {{ "%-19s" | format(d.model)}} {{d.vendor}} -{%- endfor %} +{% endfor %} """ diff --git a/src/op_mode/show_vrf.py b/src/op_mode/show_vrf.py index b6bb73d01..94358c6e4 100755 --- a/src/op_mode/show_vrf.py +++ b/src/op_mode/show_vrf.py @@ -23,9 +23,9 @@ from vyos.util import cmd vrf_out_tmpl = """ VRF name state mac address flags interfaces -------- ----- ----------- ----- ---------- -{%- for v in vrf %} +{% for v in vrf %} {{"%-16s"|format(v.ifname)}} {{ "%-8s"|format(v.operstate | lower())}} {{"%-17s"|format(v.address | lower())}} {{ v.flags|join(',')|lower()}} {{v.members|join(',')|lower()}} -{%- endfor %} +{% endfor %} """ diff --git a/src/op_mode/snmp_v3.py b/src/op_mode/snmp_v3.py index 92601f15e..a1f76f0bc 100755 --- a/src/op_mode/snmp_v3.py +++ b/src/op_mode/snmp_v3.py @@ -37,7 +37,7 @@ SNMPv3 Groups: Group View ----- ---- - {% if group -%}{% for g in group -%} + {% if group %}{% for g in group %} {{ "%-20s" | format(g.name) }}{{ g.view }}({{ g.mode }}) {% endfor %}{% endif %} """ @@ -47,7 +47,7 @@ SNMPv3 Trap-targets: Tpap-target Port Protocol Auth Priv Type EngineID User ----------- ---- -------- ---- ---- ---- -------- ---- - {% if trap -%}{% for t in trap -%} + {% if trap %}{% for t in trap %} {{ "%-20s" | format(t.name) }} {{ t.port }} {{ t.proto }} {{ t.auth }} {{ t.priv }} {{ t.type }} {{ "%-32s" | format(t.engID) }} {{ t.user }} {% endfor %}{% endif %} """ @@ -57,14 +57,14 @@ SNMPv3 Users: User Auth Priv Mode Group ---- ---- ---- ---- ----- - {% if user -%}{% for u in user -%} + {% if user %}{% for u in user %} {{ "%-20s" | format(u.name) }}{{ u.auth }} {{ u.priv }} {{ u.mode }} {{ u.group }} {% endfor %}{% endif %} """ VIEW_OUTP_TMPL_SRC = """ SNMPv3 Views: - {% if view -%}{% for v in view %} + {% if view %}{% for v in view %} View : {{ v.name }} OIDs : .{{ v.oids | join("\n .")}} {% endfor %}{% endif %} |