ソースを参照

Fix VRF detection for ff_fix_default_route.

  The former approach subtly broke things within the ffho_net module
  and/or /etc/network/interfaces. As it was unclear why just work
  around this problem, by not calling ffho_net.get_interface_config()
  twice.

Signed-off-by: Maximilian Wilhelm <max@rfc2324.org>
Maximilian Wilhelm 7 年 前
コミット
3b70502389
1 ファイル変更13 行追加9 行削除
  1. 13 9
      network/interfaces/init.sls

+ 13 - 9
network/interfaces/init.sls

@@ -44,11 +44,16 @@ ifreload:
 #
 # The fix script will be called every minute by cron and after ifreload
 # was called to try to minimize any downtime.
-{% set node_config = salt['pillar.get']('nodes:' ~ grains['id'], {}) %}
-{% set sites_config = salt['pillar.get']('sites', {}) %}
-{% set ifaces = salt['ffho_net.get_interface_config'](node_config, sites_config) %}
-{% if 'vrf_external' in ifaces %}
+{% set vrf = [False] %}
+{% for iface, iface_config in salt['pillar.get']('nodes:' ~ grains['id'] ~ ':ifaces', {}).items() %}
+  {% if iface_config.get ('vrf', '') == 'vrf_external' %}
+    {% do vrf.append(True) %}
+    {% break %}
+  {% endif %}
+{% endfor %}
+
 /usr/local/sbin/ff_fix_default_route:
+{% if True in vrf %}
   file.managed:
     - source: salt://network/interfaces/ff_fix_default_route
     - mode: 755
@@ -57,15 +62,14 @@ ifreload:
       - cmd: ifreload
     - watch:
       - file: /etc/network/interfaces
+{% else %}
+  file.absent
+{% endif %}
 
 /etc/cron.d/ff_fix_default_route:
+{% if True in vrf %}
   file.managed:
     - source: salt://network/interfaces/ff_fix_default_route.cron
-
 {% else %}
-/usr/local/sbin/ff_fix_default_route:
-  file.absent
-
-/etc/cron.d/ff_fix_default_route:
   file.absent
 {% endif %}