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

upload failed for cookbooks/audit because missing "compat_resource" #204

Closed
benlu36 opened this Issue Mar 31, 2017 · 6 comments

Comments

Projects
None yet
3 participants
@benlu36

benlu36 commented Mar 31, 2017

knife cookbook upload audit -o ./chef-cookbooks
Uploading audit [2.4.0]
ERROR: Cookbook audit depends on cookbooks which are not currently
ERROR: being uploaded and cannot be found on the server.
ERROR: The missing cookbook(s) are: 'compat_resource' version '>= 0.0.0'

Cookbook version

audit [2.4.0]

Chef-client version

Chef Development Kit Version: 1.2.22
chef-client version: 12.18.31
kitchen version: 1.15.0

Platform Details

Red Hat Enterprise Linux Server release 7.0 (Maipo)

Scenario:

[What you are trying to achieve and you can't?]
knife cookbook upload audit -o ./chef-cookbooks
...
ERROR: Cookbook audit depends on cookbooks which are not currently
ERROR: being uploaded and cannot be found on the server.
ERROR: The missing cookbook(s) are: 'compat_resource' version '>= 0.0.0'

Steps to Reproduce:

as above

Expected Result:

upload with no error, or to have updated 'compat_resource' version in the cookbook audit

Actual Result:

Failed as "ERROR: The missing cookbook(s) are: 'compat_resource' version '>= 0.0.0' "

@adamleff adamleff self-assigned this Mar 31, 2017

@adamleff

This comment has been minimized.

Collaborator

adamleff commented Mar 31, 2017

Hello, @benlu36.

This is expected behavior. knife cookbook upload does not solve any cookbook dependencies, and as you discovered, the audit cookbook depends on the compat_resource cookbook.

There are two ways to solve this:

  1. You can download the compat_resource cookbook manually and knife cookbook upload it first, or.

  2. You can use Berkshelf to upload both the compat_resource cookbook and the audit cookbook.

I would recommend using Berkshelf as it will make sure the right versions of the right dependency cookbooks are downloaded and then uploaded to your Chef Server.

From the audit cookbook directory itself, you should be able to do a berks install and then a berks upload and it will upload the cookbooks to your Chef Server for you.

I hope this helps!

~Adam

@adamleff adamleff closed this Mar 31, 2017

@benlu36

This comment has been minimized.

benlu36 commented Mar 31, 2017

Thanks, @adamleff !
Below is what I get:

pwd

/root/chef-repo/chef-cookbooks/audit

berks install

W, [2017-03-31T14:12:59.449649 #6460] WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#frozen? defined in Kernel. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-03-31T14:12:59.449898 #6460] WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#frozen? defined in Kernel. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-03-31T14:12:59.450116 #6460] WARN -- : You are setting a key that conflicts with a built-in method VariaModel::Attributes#frozen? defined in Kernel. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-03-31T14:12:59.450266 #6460] WARN -- : You are setting a key that conflicts with a built-in method VariaModel::Attributes#frozen? defined in Kernel. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-03-31T14:12:59.501178 #6460] WARN -- : You are setting a key that conflicts with a built-in method VariaModel::Attributes#default defined in Hash. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-03-31T14:12:59.501399 #6460] WARN -- : You are setting a key that conflicts with a built-in method VariaModel::Attributes#default defined in Hash. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
Resolving cookbook dependencies...
Fetching 'audit' from source at .
Fetching 'test_helper' from source at test/cookbooks/test_helper
Fetching cookbook index from https://supermarket.chef.io...
W, [2017-03-31T14:13:09.637216 #6460] WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#zip defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-03-31T14:13:16.544918 #6460] WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#zip defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-03-31T14:13:16.546160 #6460] WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#zip defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-03-31T14:13:16.547417 #6460] WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#zip defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-03-31T14:13:16.548605 #6460] WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#zip defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-03-31T14:13:16.550645 #6460] WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#zip defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-03-31T14:13:16.552220 #6460] WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#zip defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-03-31T14:13:19.370454 #6460] WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#zip defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-03-31T14:13:19.372567 #6460] WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#zip defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-03-31T14:13:19.375297 #6460] WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#zip defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-03-31T14:13:19.378044 #6460] WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#zip defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-03-31T14:13:19.380860 #6460] WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#zip defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-03-31T14:13:19.383656 #6460] WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#zip defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-03-31T14:13:19.386452 #6460] WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#zip defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-03-31T14:13:19.389080 #6460] WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#zip defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-03-31T14:13:21.839512 #6460] WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#fetch defined at /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/hashie-3.5.1/lib/hashie/mash.rb:141. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-03-31T14:13:22.873038 #6460] WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#zip defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-03-31T14:13:24.546274 #6460] WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#zip defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-03-31T14:13:24.547769 #6460] WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#zip defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-03-31T14:13:24.549158 #6460] WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#zip defined in Enumerable. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
Using audit (2.4.0) from source at .
Installing compat_resource (12.16.3)
Installing mingw (2.0.0)
Installing build-essential (8.0.0)
Installing ohai (5.0.2)
Installing git (6.0.0)
Installing dmg (3.1.0)
Installing seven_zip (2.0.2)
Using test_helper (0.1.0) from source at test/cookbooks/test_helper
Installing windows (3.0.4)
Installing yum-epel (2.1.1)
[root@psvlxccas03 audit]# pwd
/root/chef-repo/chef-cookbooks/audit

@adamleff

This comment has been minimized.

Collaborator

adamleff commented Mar 31, 2017

Yeah, that a lot of warnings you can ignore - that's fixed in the upcoming ChefDK release.

So, you ran berks install and it completed successfully! Great! This downloaded all the dependencies, etc. to your local berkshelf. Now if you do a berks upload it should upload everything it needs to your Chef Server.

@benlu36

This comment has been minimized.

benlu36 commented Mar 31, 2017

berks upload -- > works, it uploaded all cookbooks to chef server.

Thanks, @adamleff !

@iennae

This comment has been minimized.

Contributor

iennae commented Mar 31, 2017

Hi,

It looks like you might be new to Chef. The problem you are seeing is that knife cookbook upload is expecting that all dependencies of the cookbook are handled. You can't upload a cookbook to the Chef Server without uploading its dependencies. This isn't a problem specific to this cookbook, it's something that you need to understand and deal with for any cookbook that you use. The metadata.rb file will indicate what dependencies there are. You can either manually handle the dependencies by downloading them from the supermarket and uploading them, or you can use a tool like berkshelf to handle the dependencies. If you look at the Berksfile that is included you'll see that it will pull from the public supermarket https://supermarket.chef.io.

Oops. I started to respond to this earlier, and just got back to it. Just realized that @adamleff has already answered more thoroughly! Thanks @adamleff!

@adamleff

This comment has been minimized.

Collaborator

adamleff commented Apr 1, 2017

High-five, @iennae 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment