Browse Source

SDN: Bloody. Føcking. Hell.

  The batman.hosts state will trigger the generator gen_bat_hosts() to build
  a list of all known MACs and names for /etc/bat-hosts. Now gen_bat_hosts()
  will trigger get_interface_config(), which, until netbox migraton has been
  completed, has to invoke _generate_loopback_ips(), which in turn will call
  get_primary_ip(). The latter now checks wether primary_ips from netbox are
  present - or at least if the dict is present - and will fail if it happens
  to be empty. This - in general - is a good thing, as this should fail if a
  box doesn't have primary IPs set. As this was the case for some bloody box
  which will not run B.A.T.M.A.N. anyway we just ignore any nodes which come
  along without the role 'batman' set, thereby optimizing the generator.

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
Maximilian Wilhelm 3 years ago
parent
commit
4be1cfce1a
1 changed files with 3 additions and 0 deletions
  1. 3 0
      _modules/ffho_net.py

+ 3 - 0
_modules/ffho_net.py

@@ -958,6 +958,9 @@ def gen_bat_hosts (nodes_config, sites_config):
 		node_config = nodes_config.get (node_id)
 		node_name = node_id.split ('.')[0]
 
+		if 'batman' not in node_config['roles']:
+			continue
+
 		ifaces = get_interface_config (node_config, sites_config, node_id)
 		for iface in sorted (ifaces):
 			iface_config = ifaces.get (iface)