Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use :path => '..' in Cheffile #124

Open
tknerr opened this issue Jan 11, 2013 · 1 comment · Fixed by #125
Open

Cannot use :path => '..' in Cheffile #124

tknerr opened this issue Jan 11, 2013 · 1 comment · Fixed by #125

Comments

@tknerr
Copy link

tknerr commented Jan 11, 2013

When you have Cheffile inside a cookbook directory, and then try to resolve that via :path it fails because it can not copy to itself (see stacktrace below).

Cheffile

cookbook "foo",
  :path => '..'

Stacktrace

D:\path\to\foo>librarian-chef install
Installing foo (0.0.1)
V:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/1.9.1/fileutils.rb:1341:in `copy': cannot copy directory D:/path/to/foo to itself D:/path/to/foo/cookbooks/foo (ArgumentError)
        from V:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/1.9.1/fileutils.rb:465:in `block in copy_entry'
        from V:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/1.9.1/fileutils.rb:1433:in `preorder_traverse'
        from V:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/1.9.1/fileutils.rb:462:in `copy_entry'
        from V:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/1.9.1/fileutils.rb:437:in `block in cp_r'
        from V:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/1.9.1/fileutils.rb:1515:in `block in fu_each_src_dest'
        from V:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/1.9.1/fileutils.rb:1531:in `fu_each_src_dest0'
        from V:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/1.9.1/fileutils.rb:1513:in `fu_each_src_dest'
        from V:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/1.9.1/fileutils.rb:436:in `cp_r'
        from V:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/librarian-0.0.25/lib/librarian/chef/source/local.rb:41:in `install_perform_step_copy!'
        from V:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/librarian-0.0.25/lib/librarian/chef/source/local.rb:24:in `install!'
        from V:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/librarian-0.0.25/lib/librarian/manifest.rb:89:in `install!'
        from V:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/librarian-0.0.25/lib/librarian/action/install.rb:49:in `block in install_manifests'
        from V:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/librarian-0.0.25/lib/librarian/action/install.rb:48:in `each'
        from V:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/librarian-0.0.25/lib/librarian/action/install.rb:48:in `install_manifests'
        from V:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/librarian-0.0.25/lib/librarian/action/install.rb:39:in `perform_installation'
        from V:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/librarian-0.0.25/lib/librarian/action/install.rb:12:in `run'
        from V:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/librarian-0.0.25/lib/librarian/cli.rb:167:in `install!'
        from V:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/librarian-0.0.25/lib/librarian/chef/cli.rb:42:in `install'
        from V:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/task.rb:27:in `run'
        from V:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:120:in `invoke_task'
        from V:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor.rb:275:in `dispatch'
        from V:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/base.rb:425:in `start'
        from V:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/librarian-0.0.25/lib/librarian/cli.rb:28:in `block in bin!'
        from V:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/librarian-0.0.25/lib/librarian/cli.rb:45:in `with_environment'
        from V:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/librarian-0.0.25/lib/librarian/cli.rb:26:in `bin!'
        from V:/tools/vagrant/vagrant/vagrant/embedded/lib/ruby/gems/1.9.1/gems/librarian-0.0.25/bin/librarian-chef:7:in `<top (required)>'
        from V:/tools/vagrant/vagrant/vagrant/embedded/bin/librarian-chef:23:in `load'
        from V:/tools/vagrant/vagrant/vagrant/embedded/bin/librarian-chef:23:in `<main>'
@tknerr
Copy link
Author

tknerr commented Jan 11, 2013

For me this is a common scenario. Typically I have both Cheffile and Vagrantfile inside a cookbook's directory so I can do a librarian-chef install && vagrant up for a testing the cookbook in a Vagrant VM.

Until now I have to set chef.cookbooks_path = [ './cookbooks', '..' ] in the Vagrantfile to make both the resolved dependencies and the cookbook itself (via '..') available in vagrant.

This is bad because it potentially includes lots of other cookbooks from '..' which can cause all sorts of trouble, so I consider it broken.

That's why I added cookbook "foo", :path => '..' to Cheffile so that all cookbooks including "self" are resolved to ./cookbooks. Then the chef.cookbooks_path = [ './cookbooks' ] in theVagrantfile` is properly isolated again.

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

Successfully merging a pull request may close this issue.

1 participant