in cookbooks/fb_chef_hints/libraries/chef_hints_helpers.rb [36:70]
def self.valid_hints?(hints, allowed_sources = nil)
Chef::Log.debug("fb_chef_hints: validating #{hints}")
begin
allowed_sources ||= FB::ChefHintsSiteData::ALLOWED_SOURCES
rescue NameError
allowed_sources = []
end
unless allowed_sources.is_a?(Array)
fail 'fb_chef_hints: allowed_sources must be an Array (actual: ' +
"#{allowed_sources.class})"
end
%w{source hint}.each do |field|
unless hints[field]
Chef::Log.error(
"fb_chef_hints: hint #{hints} is missing mandatory field: " +
field,
)
return false
end
end
if allowed_sources.include?(hints['source'])
Chef::Log.debug(
"fb_chef_hints: hint source #{hints['source']} is allowed, " +
'proceeding',
)
return true
else
Chef::Log.error(
"fb_chef_hints: hint source #{hints['source']} is not allowed, " +
'see fb_chef_hints/README.md for details.',
)
return false
end
end