Skip to content

Commit 7a0b5d8

Browse files
author
Christopher Brown
committed
adds missing route for remote files
also cleans up a begin/rescue clause
1 parent 03a4258 commit 7a0b5d8

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

chef-server-slice/lib/chef-server-slice.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ def self.setup_router(scope)
8080
scope.match("/cookbooks/:cookbook_id/libraries").to(:controller => "cookbook_libraries", :action => "index")
8181
scope.match("/cookbooks/:cookbook_id/definitions").to(:controller => "cookbook_definitions", :action => "index")
8282
scope.match("/cookbooks/:cookbook_id/recipes").to(:controller => "cookbook_recipes", :action => "index")
83-
scope.match("/cookbooks/:cookbook_id/attributes").to(:controller => "cookbook_attributes", :action => "index")
83+
scope.match("/cookbooks/:cookbook_id/attributes").to(:controller => "cookbook_attributes", :action => "index")
84+
scope.match("/cookbooks/:cookbook_id/files").to(:controller => "cookbook_files", :action => "index")
8485

8586
scope.resources :cookbooks
8687
scope.resources :registrations, :controller => "openid_register"

chef/lib/chef/provider/remote_file.rb

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,16 @@ def do_remote_file(source, path)
8888
end
8989

9090
def get_from_uri(source)
91-
uri = URI.parse(source)
92-
if uri.absolute
93-
r = Chef::REST.new(source)
94-
Chef::Log.debug("Downloading from absolute URI: #{source}")
95-
r.get_rest(source, true).open
91+
begin
92+
uri = URI.parse(source)
93+
if uri.absolute
94+
r = Chef::REST.new(source)
95+
Chef::Log.debug("Downloading from absolute URI: #{source}")
96+
r.get_rest(source, true).open
97+
end
98+
rescue URI::InvalidURIError
99+
nil
96100
end
97-
rescue URI::InvalidURIError
98-
nil
99101
end
100102

101103
def get_from_server(source, current_checksum)

0 commit comments

Comments
 (0)