From 8864a27db606dd62b1b22ce7ab1c2ce9169cba7b Mon Sep 17 00:00:00 2001 From: Keith Whyte Date: Fri, 26 Feb 2021 06:43:37 +0100 Subject: [PATCH] fix the localnet.json generation --- modules/rhizo_base/manifests/init.pp | 11 ++----- .../rhizo_base/templates/localnet.json.erb | 29 ++++--------------- 2 files changed, 8 insertions(+), 32 deletions(-) diff --git a/modules/rhizo_base/manifests/init.pp b/modules/rhizo_base/manifests/init.pp index 778e5ef..3be4b15 100644 --- a/modules/rhizo_base/manifests/init.pp +++ b/modules/rhizo_base/manifests/init.pp @@ -144,14 +144,9 @@ class rhizo_base { $bsc_geo_lat = hiera('rhizo::bsc_geo_lat') $bsc_geo_lon = hiera('rhizo::bsc_geo_lon') - $bts1_geo_lat = hiera('rhizo::bts1_geo_lat') - $bts1_geo_lon = hiera('rhizo::bts1_geo_lon') - - $bts2_geo_lat = hiera('rhizo::bts2_geo_lat', false) - $bts2_geo_lon = hiera('rhizo::bts2_geo_lon', false) - - $bts3_geo_lat = hiera('rhizo::bts3_geo_lat', false) - $bts3_geo_lon = hiera('rhizo::bts3_geo_lon', false) + $bts_geo = [ 'shift', hiera('rhizo::bts1_geo_lat'), hiera('rhizo::bts1_geo_lon'), + hiera('rhizo::bts2_geo_lat', false), hiera('rhizo::bts2_geo_lon', false), + hiera('rhizo::bts3_geo_lat', false), hiera('rhizo::bts3_geo_lon', false) ] $link1_ip_address = hiera('rhizo::link1_ip_address', false) $link2_ip_address = hiera('rhizo::link2_ip_address', false) diff --git a/modules/rhizo_base/templates/localnet.json.erb b/modules/rhizo_base/templates/localnet.json.erb index ed125bc..5541e42 100644 --- a/modules/rhizo_base/templates/localnet.json.erb +++ b/modules/rhizo_base/templates/localnet.json.erb @@ -1,34 +1,15 @@ [ - <% if @bts1_ip_address -%> + <% @bts.each_with_index do |bts, index| %> { "type": "bts", - "ip": "<%= @bts1_ip_address %>", + "ip": "<%= bts["ip"] %>", "geo": [ - <%= @bts1_geo_lat %>, - <%= @bts1_geo_lon %> + <%= @bts_geo[2*index+1] %>, + <%= @bts_geo[2*index+2] %> ] }, <% end -%> - <% if @bts2_ip_address -%> - { - "type": "bts", - "ip": "<%= @bts2_ip_address %>", - "geo": [ - <%= @bts2_geo_lat %>, - <%= @bts2_geo_lon %> - ] - }, - <% end -%> - <% if @bts3_ip_address -%> - { - "type": "bts", - "ip": "<%= @bts3_ip_address %>", - "geo": [ - <%= @bts3_geo_lat %>, - <%= @bts3_geo_lon %> - ] - }, - <% end -%> + <% if @link1_ip_address -%> { "type": "link",