From b2024794764ce1ec793f0c91cb7989a7847860b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Jens=C3=A5s?= Date: Thu, 28 Jan 2021 01:59:08 +0100 Subject: [PATCH] Add an internal index to network_data When using the multiple nic-config templates in THT and in tripleo-ansible the ordering of networks in the network_data file matters. Add and 'idx' key internally so that we can put a tag on neutron network resources to keep track of the ordering. Conflicts: tripleo_common/utils/template.py NOTE: Now also rename unused 'net' variable to '_'. Change-Id: I6162ee854b08668274df32120e3ffc961b6cf807 Partial-Implements: blueprint network-data-v2-ports (cherry picked from commit ff52ddb3912ade33c9884e415ee260c5a57ab9f7) --- tripleo_common/actions/templates.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tripleo_common/actions/templates.py b/tripleo_common/actions/templates.py index 0a64eeea6..a2ec4852b 100644 --- a/tripleo_common/actions/templates.py +++ b/tripleo_common/actions/templates.py @@ -182,6 +182,10 @@ class ProcessTemplatesAction(base.TripleOAction): # Allow no networks defined in network_data if network_data is None: network_data = [] + # Set internal network index key for each network, network + # resources are created with a tag tripleo_net_idx + for idx, _ in enumerate(network_data): + network_data[idx].update({'idx': idx}) except swiftexceptions.ClientException: # Until t-h-t contains network_data.yaml we tolerate a missing file LOG.warning("No %s file found, ignoring"