Permalink
Browse files

Be more tolerant of variances in package filenames uploaded to Opscode.

  • Loading branch information...
1 parent 953a811 commit d61d9efd664609f07a388a46ed434c674e3cd618 @yfeldblum yfeldblum committed Aug 25, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/librarian/chef/source/site.rb
@@ -273,9 +273,11 @@ def unpack_package!(path, source)
end
# Cookbook files, as pulled from Opscode Community Site API, are
- # embedded in a subdirectory of the tarball, and the subdirectory's
- # name is equal to the name of the cookbook.
- subtemp = temp.join(name)
+ # embedded in a subdirectory of the tarball.
+ subtemps = temp.children
+ subtemps.empty? and raise "The package archive was empty!"
+ subtemps.size > 1 and raise "The package archive has too many children!"
+ subtemp = subtemps.first
debug { "Moving #{relative_path_to(subtemp)} to #{relative_path_to(path)}" }
FileUtils.mv(subtemp, path)
ensure

0 comments on commit d61d9ef

Please sign in to comment.