[daisy] network template: Fix set inside loop
[pharos.git] / config / installers / daisy / network.yaml.j2
index c344688..f976ab7 100644 (file)
@@ -1,5 +1,5 @@
 ##############################################################################
-# Copyright (c) 2017 ZTE Corporation and others.
+# Copyright (c) 2018 ZTE Corporation and others.
 #
 # All rights reserved. This program and the accompanying materials
 # are made available under the terms of the Apache License, Version 2.0
@@ -39,18 +39,12 @@ network-config-metadata:
     {%- set installer = "fuel" -%}
   {%- endif %}
 
-{%- if conf.net_config is defined -%}
-    {%- set conf_net_config = conf.net_config -%}
-{%- elif conf.idf.net_config is defined -%}
-    {%- set conf_net_config = conf.idf.net_config -%}
-{%- endif %}
-
 networks:
 
   {%- set nodes_num = conf['nodes'] | length -%}
   {%- set networks = {} -%}
   {%- for key in mapping -%}
-    {%- set net_data = conf_net_config[mapping[key]] -%}
+    {%- set net_data = conf.idf.net_config[mapping[key]] -%}
     {%- set interface = net_data['interface'] -%}
     {%- set interface_name = conf.idf[installer].network.node[0].interfaces[interface] -%}
     {%- set bus_addr = conf.idf[installer].network.node[0].busaddr[interface] -%}
@@ -78,7 +72,8 @@ networks:
       {%- set gateway = ".".join([ips[0], ips[1], ips[2], "1"]) -%}
     {%- endif -%}
 
-    {%- set networks = networks.update({key: {'interface_name': interface_name,
+    {#- set v=v.update(...) is unpredictable and breaks in older j2 -#}
+    {%- set _ = networks.update({key: {'interface_name': interface_name,
                                               'bus_addr': bus_addr,
                                               'vlan': vlan,
                                               'network': network,