Skip to content

Commit

Permalink
Fix berkshelf lockfile loading for berkshelf 3.x
Browse files Browse the repository at this point in the history
Fix copied from mjuarez post here:

jonlives#109

ongoing other issue

jonlives#130
  • Loading branch information
Chris Earnhardt & Nik Keating committed Jul 9, 2014
1 parent 4fb73a2 commit 580c0a8
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/knife-spork/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,14 @@ def load_from_chef(name)
def load_from_berkshelf(name)
return unless defined?(::Berkshelf)
berksfile = ::Berkshelf::Berksfile.from_file(self.config[:berksfile])
lockfile = ::Berkshelf::Lockfile.new(berksfile)
lockfile = ::Berkshelf::Lockfile.from_berksfile(berksfile)

raise Berkshelf::BerkshelfError, "LockFileNotFound" unless File.exists?(lockfile.filepath)

cookbook = Berkshelf.ui.mute {
self.config[:skip_dependencies] ||= false
berksfile.resolve(lockfile.find(name), {skip_dependencies: self.config[:skip_dependencies]})[:solution].first
}
cookbook = lockfile.retrieve(name)

#convert Berkshelf::CachedCookbook to Chef::CookbookVersion
::Chef::CookbookLoader.new(File.dirname(cookbook.path))[name]
::Chef::CookbookLoader.new(File.dirname(cookbook.path))[File.basename(cookbook.path)]

end

Expand Down

0 comments on commit 580c0a8

Please sign in to comment.