From d61d9efd664609f07a388a46ed434c674e3cd618 Mon Sep 17 00:00:00 2001 From: Jay Feldblum Date: Sat, 25 Aug 2012 00:53:45 -0400 Subject: [PATCH] Be more tolerant of variances in package filenames uploaded to Opscode. --- lib/librarian/chef/source/site.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/librarian/chef/source/site.rb b/lib/librarian/chef/source/site.rb index 0ce58457..bacacc41 100644 --- a/lib/librarian/chef/source/site.rb +++ b/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