From: Tollef Fog Heen Date: Fri, 2 Feb 2018 05:49:53 +0000 (+0100) Subject: Fix has_role to handle richer data structures properly X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=c4c9a52df83e66cd9ed5039f66756529e06c6416;p=mirror%2Fdsa-puppet.git Fix has_role to handle richer data structures properly --- diff --git a/modules/puppetmaster/lib/puppet/parser/functions/has_role.rb b/modules/puppetmaster/lib/puppet/parser/functions/has_role.rb index c8b537f79..5c1af8e04 100644 --- a/modules/puppetmaster/lib/puppet/parser/functions/has_role.rb +++ b/modules/puppetmaster/lib/puppet/parser/functions/has_role.rb @@ -7,6 +7,11 @@ module Puppet::Parser::Functions err "Failed to look up missing role #{role}" return false end - return roles[role].include?(fqdn) + return roles[role].map{ |k| + case k + when Hash then k.keys.first + else k + end + }.include?(fqdn) end end