25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/chef/mixin/generate_url.rb', line 25
def generate_cookbook_url(url, cookbook, type, node, args=nil)
Chef::Log.debug("generating cookbook url for url=#{url}, cookbook=#{cookbook.inspect}, type=#{type}, node=#{node}")
new_url = nil
if url =~ /^(http|https):\/\//
new_url = url
else
new_url = "cookbooks/#{cookbook}/#{type}?"
new_url += "id=#{url}"
platform, version = Chef::Platform.find_platform_and_version(node)
if type == "files" || type == "templates"
new_url += "&platform=#{platform}&version=#{version}&fqdn=#{node[:fqdn]}&node_name=#{node.name}"
end
if args
args.each do |key, value|
new_url += "&#{key}=#{value}"
end
end
end
Chef::Log.debug("generated cookbook url: #{new_url}")
return new_url
end
|