Simplify lookups now that security_mirror is a hash
authorTollef Fog Heen <tfheen@err.no>
Fri, 2 Feb 2018 09:24:41 +0000 (10:24 +0100)
committerTollef Fog Heen <tfheen@err.no>
Fri, 2 Feb 2018 09:24:41 +0000 (10:24 +0100)
modules/roles/manifests/security_mirror.pp

index 472a145..c7afdeb 100644 (file)
@@ -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':