From 8100e96777982ca1cba4a2d5f59980ce1e574a1a Mon Sep 17 00:00:00 2001 From: Zen Fu <zen@systemli.org> Date: Tue, 14 Jan 2025 11:00:33 -0300 Subject: [PATCH] allow definition of more than one network interface refs tpo/tpa/team#41958 --- manifests/profile/network.pp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/manifests/profile/network.pp b/manifests/profile/network.pp index de9ece8d0..17b14809b 100644 --- a/manifests/profile/network.pp +++ b/manifests/profile/network.pp @@ -28,17 +28,17 @@ class tails::profile::network ( create_resources('network_config', $interfaces) -# if we only have 1 interface defined here, we can be sure this is the +# if we have at least 1 interface defined here, we assume the first of them has the # IP we want to share for other hosts to add to their /etc/hosts file. if $export_host { - if $interfaces.length == 1 { - $interfaces.each | String $iface, Hash $config | { - @@host { $facts['networking']['fqdn']: - ip => $config['ipaddress'], - host_aliases => $facts['networking']['hostname'], - tag => 'hello_neighbour', - } + if $interfaces.length >= 1 { + $iface = $interfaces.keys[0] + $config = $interfaces[$iface] + @@host { $facts['networking']['fqdn']: + ip => $config['ipaddress'], + host_aliases => $facts['networking']['hostname'], + tag => 'hello_neighbour', } } } -- GitLab