From 16dd6904ed60f5f831a15d5eeb8901405764e989 Mon Sep 17 00:00:00 2001 From: Tollef Fog Heen Date: Fri, 2 Feb 2018 07:45:53 +0100 Subject: [PATCH] Stop hard coding host list for debian_mirror and use the same code we use for security --- modules/roles/manifests/debian_mirror.pp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/roles/manifests/debian_mirror.pp b/modules/roles/manifests/debian_mirror.pp index cde099240..cdd2de944 100644 --- a/modules/roles/manifests/debian_mirror.pp +++ b/modules/roles/manifests/debian_mirror.pp @@ -37,10 +37,12 @@ class roles::debian_mirror { } } -# $mirrors = hiera_hash('roles::debian_mirror',[]) -# $fastly_mirrors = $mirrors.filter |$h| { $h[1]['fastly-backend'] } -# $hosts_to_check = $fastly_mirrors.map | $h| { $h1['service-hostname'] } - $hosts_to_check = ['accumu.debian.backend.mirrors.debian.org', 'bytemark.debian.backend.mirrors.debian.org', 'conova.debian.backend.mirrors.debian.org', 'skroutz.debian.backend.mirrors.debian.org'] + # roles is a list of hashes, which needs to be unpacked into a regular hash + $mirrors = hiera('roles.debian_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'] } + $hosts_to_check = $fastly_mirrors.map |$h| { $h[1]['service-hostname'] } roles::mirror_health { 'ftp': check_hosts => $hosts_to_check, -- 2.20.1