Skip to content

Commit

Permalink
Print a message if we think the module failed to download from the forge
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Sanchez committed Apr 3, 2014
1 parent 0cd7c7c commit b814a79
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/librarian/puppet/source/forge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,18 @@ def cache_version_unpacked!(version)
Librarian::Posix.run!(command)
rescue Posix::CommandFailure => e
# Rollback the directory if the puppet module had an error
path.unlink rescue nil
raise Error, "Error executing puppet module install:\n#{command.join(" ")}\nError:\n#{e.message}"
begin
path.unlink
rescue => u
warn("Unable to rollback path #{path}: #{u}")
end
tar = Dir[File.join(path.to_s, "**/*.tar.gz")]
msg = ""
if e.message =~ /Unexpected EOF in archive/ and !tar.empty?
file = tar.first
msg = " (looks like an incomplete download of #{file})"
end
raise Error, "Error executing puppet module install#{msg}:\n#{command.join(" ")}\nError:\n#{e.message}"
end

end
Expand Down

0 comments on commit b814a79

Please sign in to comment.