1

I am using Chef to create a customized cookbook for the ELK stack.

I found an ELK stack cookbook in the Chef supermarket and I'm trying to download it as a dependency using Berkshelf.

My Berksfile contains:

source 'https://supermarket.chef.io'

metadata

cookbook 'elkstack', '~> 6.0.4'

And metadata.rb:

name             'myelkstack'
maintainer       'YOUR_COMPANY_NAME'
maintainer_email 'YOUR_EMAIL'
license          'All rights reserved'
description      'Installs/Configures cmselkstack'
long_description  IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version          '0.1.0'
depends          'elkstack'

I intend to run this cookbook locally so I'm using berks vendor instead of berks install. When I run berks vendor I expect the dependencies to be downloaded, however it hangs:

$ berks vendor /home/pviana/berks 
Resolving cookbook dependencies...
Fetching 'cmselk' from source at .
Fetching cookbook index from https://supermarket.chef.io...

However, if I run knife cookbook site download elkstack, it works perfectly and downloads v6.0.4. Also, if I change the cookbook from elkstack to another cookbook (and the appropriate version), the command works and all the dependencies are downloaded.

Is it possible that I'm missing something?

Thanks.

MisterStrickland
  • 947
  • 1
  • 15
  • 35
  • Specify the version in your metadata.rb, nit in the Berksfile. Not sure, if that's the reason why it doesn't work, but you want your cookbook to also use that exact version later. – StephenKing Aug 02 '16 at 18:01
  • 2
    You should still be running `berks install`, you just run `berks vendor` _after_ that. – coderanger Aug 02 '16 at 18:54
  • 1
    That said, it's probably fixing that for you automatically, but still worth a shot. Make sure you don't have a grump lockfile too (i.e. run `berks up`). – coderanger Aug 02 '16 at 18:54
  • Thank you - the lockfile didn't exist and `berks up` pointed that out. I tried running `berks install` and it also hangs. Other cookbooks work fine, even with `berks vendor`. – MisterStrickland Aug 02 '16 at 19:10

1 Answers1

0

The cookbook I was trying to build is very complex (elkstack) and requires the user to manually edit Berksfile before running berks vendor. This hanging behavior is expected by default unless the dependencies are carefully worked out.

MisterStrickland
  • 947
  • 1
  • 15
  • 35