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

cookbook files not copied to vagrant box #328

Closed
cstewart87 opened this issue Jan 16, 2014 · 8 comments
Closed

cookbook files not copied to vagrant box #328

cstewart87 opened this issue Jan 16, 2014 · 8 comments

Comments

@cstewart87
Copy link

.kitchen.yml

---
driver:
  name: vagrant

platforms:
  - name: ubuntu-12.04

provisioner:
  name: chef_zero
  roles_path: roles
  client_rb:
    cookbook_path:
      - /tmp/kitchen/cookbooks/components
      - /tmp/kitchen/cookbooks/profiles

suites:
  - name: routerlb
    run_list:
      - 'role[routerlb]'
    attributes:

Section of log output

...
[2014-01-16T16:18:43+00:00] WARN: Cookbook 'vault_app' is empty or entirely chefignored at /tmp/kitchen/cookbooks/components/vault_app
[2014-01-16T16:18:43+00:00] WARN: Cookbook 'workstation' is empty or entirely chefignored at /tmp/kitchen/cookbooks/components/workstation
...

Addt'l info

  • Using a chef repo.
  • .kitchen.yml at root of repo.
  • All cookbook directories are copied over, but no files
  • test-kitchen v1.1.1
@sethvargo
Copy link
Contributor

"or entirely chefignored"

Could you post your chefignore (if it exists)?

@adnichols
Copy link

@sethvargo Does test-kitchen care about the chefignore? My understanding was that it was completely ignored in favor of a glob pattern which can be overwritten in the kitchen yaml, which has me really curious about that message, maybe something specific to the vagrant plugin?

@fnichol
Copy link
Contributor

fnichol commented Jan 16, 2014

Okay, I see what's going on here: the client_rb block only sets up client.rb on the remote instance. You still need to use the Berksfile, Cheffile, ./cookbooks (and ./site-cookbooks), ./metadata.rb cookbook detection fallback.

Looking at this part of the code with fresh eyes, it looks like we should add a cookbooks_path default_config so that you could set up something like:

---
provisioner:
  cookbooks_path: /other/cookbooks

or

---
provisioner:
  cookbooks_path:
    - /common/project/cookbooks/components
    - /common/project/cookbooks/profiles

If we had support for this, then all cookbooks would end up in /tmp/kitchen/cookbooks on the instances. Would that help?

In the meantime, assuming you don't already have a Berksfile around for this project you can specify cookbooks by path like:

site :opscode

components_dir = "/common/cookbooks/components"
profiles_dir = "/common/cookbooks/profiles"

Dir.entries(components_dir).select { |d| File.directory?(d) && !%w{. ..}.include?(d) }.each do |name|
  cookbook name, path: "#{components_dir}/#{name}"
end

Dir.entries(profiles_dir).select { |d| File.directory?(d) && !%w{. ..}.include?(d) }.each do |name|
  cookbook name, path: "#{profiles_dir}/#{name}"
end

@fnichol
Copy link
Contributor

fnichol commented Jan 16, 2014

@adnichols And to clarify your question, no, Test Kitchen doesn't parse or chefignore on the workstation side.

@adnichols
Copy link

@fnichol So doesn't that message he's getting seem misleading? Or is that not coming from test-kitchen?

@fnichol
Copy link
Contributor

fnichol commented Jan 16, 2014

@adnichols I'd agree it's totally misleading 😄 Unfortunetly, that's coming from chef-solo finding an empty directory for one of its cookbook_path entries. I found this out when trying to make Test Kitchen without any cookbooks at all (I needed to dummy a no-op cookbook to make chef-solo happy).

@cstewart87
Copy link
Author

@fnichol The issue I had come across with my Berksfile was that it was not "correctly" determining dependencies, or at least not determining them the way I'd want to. Each cookbook still has its own Berksfile, but from this thread I noticed that Berkshelf doesn't resolve nested Berksfiles.

@sethvargo
Copy link
Contributor

Closing, as this isn't really a bug in Test Kitchen. If anything, it's a bug in Chef Solo, but it's more than likely a miscommunication in documentation. @fnichol is going to work on adding those docs 😄

@test-kitchen test-kitchen locked and limited conversation to collaborators Nov 16, 2017
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

4 participants