From 776f8d5ca0366e1639a9f4dfdb3f74c39dd48cde Mon Sep 17 00:00:00 2001 From: Tollef Fog Heen Date: Fri, 2 Feb 2018 10:24:41 +0100 Subject: [PATCH] Simplify lookups now that security_mirror is a hash --- modules/roles/manifests/security_mirror.pp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/modules/roles/manifests/security_mirror.pp b/modules/roles/manifests/security_mirror.pp index 472a1458e..c7afdeb7c 100644 --- a/modules/roles/manifests/security_mirror.pp +++ b/modules/roles/manifests/security_mirror.pp @@ -36,11 +36,8 @@ class roles::security_mirror { content => template('roles/security_mirror/security.debian.org.erb') } - # roles is a list of hashes, which needs to be unpacked into a regular hash - $mirrors = hiera('roles.security_mirror', []) - # unpack $mirrors and construct a hash - $m2 = Hash($mirrors.map |$h| { $h.map |$k, $v| { [$k, $v] }[0]}) - $fastly_mirrors = $m2.filter |$h| { $h[1]['fastly-backend'] } + $mirrors = hiera('roles.security_mirror', {}) + $fastly_mirrors = $mirrors.filter |$h| { $h[1]['fastly-backend'] } $hosts_to_check = $fastly_mirrors.map |$h| { $h[1]['service-hostname'] } roles::mirror_health { 'security': -- 2.20.1