Browse Source

network: Remove deprecated '_udev_mac' attribute in favour of 'mac' attribute.

  Previously a manually defined MAC address for an interface had to be
  specified as '_udev_mac' in the nodes pillar stanza. In alignment with
  netbox this field has been renamed to 'mac'.

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
Maximilian Wilhelm 4 years ago
parent
commit
d144a085e0
4 changed files with 6 additions and 6 deletions
  1. 1 1
      network/link.sls
  2. 1 1
      network/systemd-link.tmpl
  3. 2 2
      network/udev-rules.tmpl
  4. 2 2
      zz_EXAMPLE_PILLAR/nodes/gw03.sls

+ 1 - 1
network/link.sls

@@ -14,7 +14,7 @@
 
 # Systemd link files?
   {% for iface, iface_config in salt['pillar.get']('nodes:' ~ grains['id'] ~ ':ifaces', {}).items ()|sort %}
-    {% if '_udev_mac' in iface_config or 'mac' in iface_config %}
+    {% if 'mac' in iface_config %}
 /etc/systemd/network/42-{{ iface }}.link:
   file.managed:
     - source: salt://network/systemd-link.tmpl

+ 1 - 1
network/systemd-link.tmpl

@@ -1,4 +1,4 @@
-{%- set mac = iface_config.get ('mac', iface_config.get ('_udev_mac')) -%}
+{%- set mac = iface_config.get ('mac') -%}
 #
 # {{ interface }} / {{ desc }}
 #

+ 2 - 2
network/udev-rules.tmpl

@@ -2,8 +2,8 @@
 # FFHO net rules (Salt managed)
 #
 {%- for iface, iface_config in salt['pillar.get']('nodes:' ~ grains['id'] ~ ':ifaces', {}).items ()|sort %}
-  {%- if '_udev_mac' in iface_config or 'mac' in iface_config %}
-    {%- set mac = iface_config.get ('mac', iface_config.get ('_udev_mac')) -%}
+  {%- if 'mac' in iface_config %}
+    {%- set mac = iface_config.get ('mac') -%}
 # {{ iface_config.get ('desc', '') }}
 SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="{{ mac }}", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="{{ iface }}"
 

+ 2 - 2
zz_EXAMPLE_PILLAR/nodes/gw03.sls

@@ -23,7 +23,7 @@ gw03.in.ffho.net:
 
     eth0:
       desc: SysEleven
-      _udev_mac: 52:54:1f:03:01:63
+      mac: 52:54:1f:03:01:63
       #
       prefixes:
         - 185.46.137.163/25
@@ -35,7 +35,7 @@ gw03.in.ffho.net:
 
     vlan1015:
       desc: L2-BER
-      _udev_mac: 52:54:1f:03:10:15
+      mac: 52:54:1f:03:10:15
       prefixes:
         - <POP L2-Subnet prefix v4>/28
         - <POP L2-Subnet prefix v6>/64