]> git.donarmstrong.com Git - dsa-puppet.git/commitdiff
Log error rather than exploding unhelpfully
authorTollef Fog Heen <tfheen@err.no>
Thu, 2 Jan 2014 17:44:31 +0000 (18:44 +0100)
committerTollef Fog Heen <tfheen@err.no>
Thu, 2 Jan 2014 17:44:31 +0000 (18:44 +0100)
modules/puppetmaster/lib/puppet/parser/functions/has_role.rb

index a8f9fd3a30d1d7ccaca9d39e49994aad09ab720f..64633ced585a09de4100f5c22d058354ced56d4e 100644 (file)
@@ -4,6 +4,10 @@ module Puppet::Parser::Functions
       role = args.shift
       roles = lookupvar('site::roles')
       fqdn = lookupvar('fqdn')
+      if not roles.include?(role)
+        error "Failed to look up missing role #{role}"
+        return False
+      end
       return roles[role].include?(fqdn)
     end
   end