Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Strainer::Error::CookbookNotFound - Could not find 'foo' in any of the sources. #37

Open
akatz opened this issue Aug 8, 2013 · 6 comments

Comments

@akatz
Copy link

akatz commented Aug 8, 2013

Using berkshelf, with a particular cookbook pointed at a local path, I get this errror when trying to
bundle exec strainer test foo -d

[DEBUG]   Called Strainer::Cli#test with ["foo"]
[DEBUG]   Created new Strainer::Runner with ["foo"], options: {"strainer_file"=>"Strainerfile", "sandbox"=>"/var/folders/kn/q1rhkdm14bj6l4lr5cw3g5wm0000gn/T/d20130808-7970-1i2xqsv", "debug"=>true, "color"=>true, "fail_fast"=>false}
[DEBUG]   Detected as a chef repo
[DEBUG]   Sandbox#load_cookbooks(["foo"])
[DEBUG]   Sandbox#load_cookbook('"foo"')
[DEBUG]   Setting Sandbox#cookbooks_paths to ["/Users/akatz/projects/foo-chef/cookbooks"]
[DEBUG]     did not find 'foo' in any of the sources - resorting to the default cookbook_store...
Exception `Errno::EEXIST' at /Users/akatz/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/fileutils.rb:244 - File exists - /Users/akatz/.berkshelf/cookbooks
Exception `Strainer::Error::CookbookNotFound' at /Users/akatz/.rvm/gems/ruby-1.9.3-p392@chef/bundler/gems/strainer-cde81aaaac51/lib/strainer/sandbox.rb:176 - Could not find 'foo' in any of the sources.
Strainer::Error::CookbookNotFound - Could not find 'foo' in any of the sources.
   /Users/akatz/.rvm/gems/ruby-1.9.3-p392@chef/bundler/gems/strainer-cde81aaaac51/lib/strainer/sandbox.rb:176:in `load_cookbook'
   /Users/akatz/.rvm/gems/ruby-1.9.3-p392@chef/bundler/gems/strainer-cde81aaaac51/lib/strainer/sandbox.rb:147:in `block in load_cookbooks'
   /Users/akatz/.rvm/gems/ruby-1.9.3-p392@chef/bundler/gems/strainer-cde81aaaac51/lib/strainer/sandbox.rb:147:in `collect'
   /Users/akatz/.rvm/gems/ruby-1.9.3-p392@chef/bundler/gems/strainer-cde81aaaac51/lib/strainer/sandbox.rb:147:in `load_cookbooks'
   /Users/akatz/.rvm/gems/ruby-1.9.3-p392@chef/bundler/gems/strainer-cde81aaaac51/lib/strainer/sandbox.rb:45:in `initialize'
   /Users/akatz/.rvm/gems/ruby-1.9.3-p392@chef/bundler/gems/strainer-cde81aaaac51/lib/strainer/runner.rb:36:in `new'
   /Users/akatz/.rvm/gems/ruby-1.9.3-p392@chef/bundler/gems/strainer-cde81aaaac51/lib/strainer/runner.rb:36:in `initialize'
   /Users/akatz/.rvm/gems/ruby-1.9.3-p392@chef/bundler/gems/strainer-cde81aaaac51/lib/strainer/cli.rb:77:in `new'
   /Users/akatz/.rvm/gems/ruby-1.9.3-p392@chef/bundler/gems/strainer-cde81aaaac51/lib/strainer/cli.rb:77:in `test'
   /Users/akatz/.rvm/gems/ruby-1.9.3-p392@chef/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
   /Users/akatz/.rvm/gems/ruby-1.9.3-p392@chef/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
   /Users/akatz/.rvm/gems/ruby-1.9.3-p392@chef/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
   /Users/akatz/.rvm/gems/ruby-1.9.3-p392@chef/bundler/gems/strainer-cde81aaaac51/lib/strainer/cli.rb:35:in `dispatch'
   /Users/akatz/.rvm/gems/ruby-1.9.3-p392@chef/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
   /Users/akatz/.rvm/gems/ruby-1.9.3-p392@chef/bundler/gems/strainer-cde81aaaac51/bin/strainer:8:in `<top (required)>'
   /Users/akatz/.rvm/gems/ruby-1.9.3-p392@chef/bin/strainer:19:in `load'
   /Users/akatz/.rvm/gems/ruby-1.9.3-p392@chef/bin/strainer:19:in `<main>'
   /Users/akatz/.rvm/gems/ruby-1.9.3-p392@chef/bin/ruby_noexec_wrapper:14:in `eval'
   /Users/akatz/.rvm/gems/ruby-1.9.3-p392@chef/bin/ruby_noexec_wrapper:14:in `<main>'
Releasing ManagedGssBufferDesc at 7f8e8cd5ed10
@sethvargo
Copy link
Contributor

This might sound like a silly question, but is that cookbook in the path?

@akatz
Copy link
Author

akatz commented Aug 8, 2013

Doesn't it have to be? berkshelf itself finds my cookbook at that path or it would error. It's obviously not in berkshelf's cookbook directory as it's just referencing one on my local machine.
Maybe strainer is not following the berksfile and instead just looking in berkshelf's local dir?

for reference from berks install
Using foo (0.8.4) at './custom_cookbooks/foo'

@sethvargo
Copy link
Contributor

@akatz right - it defaults to looking in .berkshelf. I'm going to leave this open. Strainer will get a re-write when Berkshelf 3.0 comes out.

@mikelococo
Copy link

I've been bitten by this as well. It looks like Strainer can't work with "local" sources that are defined in the Berksfile with a path. The following will fail:

cookbook 'my-cookbook', :path => '../my-cookbook'

If you define the same cookbook as a remote source fetched via git, it worked just fine as this it will then be downloaded into the .berkshelf/cookbooks directory.

For more details, see: berkshelf/berkshelf#227

@daxroc
Copy link

daxroc commented Feb 21, 2014

You can bypass this issue with using ruby to fill the parent path in your Berksfile

parent_dir = File.expand_path("..",File.dirname(__FILE__))

site :opscode

metadata
cookbook "myface", path: "#{parent_dir}/myface"

You'll also need to have a valid .chef/knife.rb
Unsure if this is bad practice or not ?

@rshade
Copy link

rshade commented Aug 21, 2015

I am having the same problem with Strainer 3.4.0 and Berkshelf 3.3.0 with git repos.
https://github.com/RightScale-Services-Cookbooks/rsc_gluster/blob/STRAINER_3_4_0/Gemfile
https://github.com/RightScale-Services-Cookbooks/rsc_gluster/blob/STRAINER_3_4_0/Berksfile#L5
I am getting Strainer::Error::CookbookNotFound - Could not find 'gluster' in any of the sources. even though berks install works. https://travis-ci.org/RightScale-Services-Cookbooks/rsc_gluster/jobs/76630938

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants