Parcourir la source

templates: Remove new line if variable not present

Sebastien Badia il y a 9 ans
Parent
commit
d42940ff39
3 fichiers modifiés avec 8 ajouts et 9 suppressions
  1. 2 2
      templates/bird_v4.j2
  2. 2 2
      templates/bird_v6.j2
  3. 4 5
      templates/quagga.j2

+ 2 - 2
templates/bird_v4.j2

@@ -1,7 +1,7 @@
 protocol bgp {{ ix_name }}_{{ neighbor_as }} from tpl_{{ ix_name }}_peers {
     neighbor {{ neighbor_ipv4 }} as {{ neighbor_as }};
     description "{{ ix_name }} / {{ description }}";
-    {% if limit_ipv4 %}
+    {%- if limit_ipv4 %}
     import limit {{ limit_ipv4 }};
-    {% endif %}
+    {%- endif %}
 }

+ 2 - 2
templates/bird_v6.j2

@@ -1,7 +1,7 @@
 protocol bgp {{ ix_name }}_{{ neighbor_as }} from tpl_{{ ix_name }}_peers {
     neighbor {{ neighbor_ipv6 }} as {{ neighbor_as }};
     description "{{ ix_name }} / {{ description }}";
-    {% if limit_ipv6 %}
+    {%- if limit_ipv6 %}
     import limit {{ limit_ipv6 }};
-    {% endif %}
+    {%- endif %}
 }

+ 4 - 5
templates/quagga.j2

@@ -3,14 +3,13 @@ router bgp 20766
 neighbor {{ neighbor_ipv4 }} remote-as {{ neighbor_as }}
 neighbor {{ neighbor_ipv4 }} peer-group {{ ix_name }}_FIXME
 neighbor {{ neighbor_ipv4 }} description "====== {{ description }}"
-{% if limit_ipv4 %}
+{%- if limit_ipv4 %}
 neighbor {{ neighbor_ipv4 }} maximum-prefix {{ limit_ipv4 }}
-{% endif %}
-#
+{%- endif %}
 neighbor {{ neighbor_ipv6 }} remote-as {{ neighbor_as }}
 neighbor {{ neighbor_ipv6 }} description "====== {{ description }}"
 address-family ipv6
 neighbor {{ neighbor_ipv6 }} peer-group {{ ix_name }}_FIXME
-{% if limit_ipv6 %}
+{%- if limit_ipv6 %}
 neighbor {{ neighbor_ipv6 }} maximum-prefix {{ limit_ipv6 }}
-{% endif %}
+{%- endif %}