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

chef-sugar dep breaks 'knife cookbook site install openssl' #9

Closed
jblaine opened this issue Oct 29, 2014 · 5 comments
Closed

chef-sugar dep breaks 'knife cookbook site install openssl' #9

jblaine opened this issue Oct 29, 2014 · 5 comments

Comments

@jblaine
Copy link

jblaine commented Oct 29, 2014

I'm blocked from Seth Vargo's repositories. He doesn't like me. As a result, I cannot create a Github issue at sethvargo/chef-sugar in order to report this.

The openssl cookbook is broken by its new chef-sugar dependency as chef-sugar has no metadata.rb and that breaks 'knife cookbook site install openssl'

...
 delete mode 100644 cookbooks/openssl/CONTRIBUTING
 delete mode 100644 cookbooks/openssl/LICENSE
 create mode 100644 cookbooks/openssl/attributes/default.rb
 create mode 100644 cookbooks/openssl/providers/x509.rb
 create mode 100644 cookbooks/openssl/recipes/upgrade.rb
 create mode 100644 cookbooks/openssl/resources/x509.rb
Cookbook openssl version 2.0.0 successfully installed
Installing chef-sugar to /afs/rcf/user/jblaine/rcf-chef/cookbooks
Checking out the master branch.
Creating pristine copy branch chef-vendor-chef-sugar
Downloading chef-sugar from the cookbooks site at version 2.4.1 to /afs/rcf/user/jblaine/rcf-chef/cookbooks/chef-sugar.tar.gz
Cookbook saved: /afs/rcf/user/jblaine/rcf-chef/cookbooks/chef-sugar.tar.gz
Removing pre-existing version.
Uncompressing chef-sugar version 2.4.1.
removing downloaded tarball
1 files updated, committing changes
Creating tag cookbook-site-imported-chef-sugar-2.4.1
Checking out the master branch.
Updating 5ce953d..1d0697d
Fast-forward
 cookbooks/chef-sugar/CHANGELOG.md       | 115 ++++++++++++++++
 cookbooks/chef-sugar/README.md          | 451 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 cookbooks/chef-sugar/metadata.json      |  29 ++++
 cookbooks/chef-sugar/recipes/default.rb |  27 ++++
 4 files changed, 622 insertions(+)
 create mode 100644 cookbooks/chef-sugar/CHANGELOG.md
 create mode 100644 cookbooks/chef-sugar/README.md
 create mode 100644 cookbooks/chef-sugar/metadata.json
 create mode 100644 cookbooks/chef-sugar/recipes/default.rb
Cookbook chef-sugar version 2.4.1 successfully installed
ERROR: IOError: Cannot open or read /afs/rcf/user/jblaine/rcf-chef/cookbooks/chef-sugar/metadata.rb!
[@gazoo:~/rcf-chef/cookbooks] master(2)+ 27s 100 ± ls chef-sugar/
CHANGELOG.md  metadata.json  README.md  recipes/
[@gazoo:~/rcf-chef/cookbooks] master(2)+ ±
@nathenharvey
Copy link
Contributor

Looks like knife cookbook site install does require a metadata.rb but sharing a cookbook doesn't require a metadata.rb so long as there is a metadata.json. Lots of little things here that could have lots of side effects.

The fastest way to work around the issue is to manually create a metadata.rb in your local chef-sugar cookbook.

@jblaine
Copy link
Author

jblaine commented Oct 31, 2014

Fetching the raw metadata.rb from Seth's repo doesn't solve the issue, unfortunately. knife cookbook site install openssl just keeps snarfing a new copy of chef-sugar and finds no metadata.rb there again:

[@gazoo:~/rcf-chef/cookbooks] master(2)+* ± knife cookbook site install openssl
...
ERROR: IOError: Cannot open or read /afs/rcf/user/jblaine/rcf-chef/cookbooks/chef-sugar/metadata.rb!
[@gazoo:~/rcf-chef/cookbooks] master(2)+ 6s 100 ± wget --quiet -O chef-sugar/metadata.rb https://raw.githubusercontent.com/sethvargo/chef-sugar/master/metadata.rb
[@gazoo:~/rcf-chef/cookbooks] master(2)+* ± knife cookbook site install openssl
Installing openssl to /afs/rcf/user/jblaine/rcf-chef/cookbooks
Checking out the master branch.
Pristine copy branch (chef-vendor-openssl) exists, switching to it.
Downloading openssl from the cookbooks site at version 2.0.0 to /afs/rcf/user/jblaine/rcf-chef/cookbooks/openssl.tar.gz
Cookbook saved: /afs/rcf/user/jblaine/rcf-chef/cookbooks/openssl.tar.gz
Removing pre-existing version.
Uncompressing openssl version 2.0.0.
removing downloaded tarball
No changes made to openssl
Checking out the master branch.
Installing chef-sugar to /afs/rcf/user/jblaine/rcf-chef/cookbooks
Checking out the master branch.
Pristine copy branch (chef-vendor-chef-sugar) exists, switching to it.
Downloading chef-sugar from the cookbooks site at version 2.4.1 to /afs/rcf/user/jblaine/rcf-chef/cookbooks/chef-sugar.tar.gz
Cookbook saved: /afs/rcf/user/jblaine/rcf-chef/cookbooks/chef-sugar.tar.gz
Removing pre-existing version.
Uncompressing chef-sugar version 2.4.1.
removing downloaded tarball
No changes made to chef-sugar
Checking out the master branch.
ERROR: IOError: Cannot open or read /afs/rcf/user/jblaine/rcf-chef/cookbooks/chef-sugar/metadata.rb!
[@gazoo:~/rcf-chef/cookbooks] master(2)+ 5s 100 ±

@nathenharvey
Copy link
Contributor

I think you need to commit your new metadata.rb to your git repository. The following are working for me:

  knife cookbook site install openssl
  wget --quiet -O cookbooks/chef-sugar/metadata.rb https://gist.githubusercontent.com/nathenharvey/8080ed328a37cea92ad2/raw/596870cfabe8558bae34f6ae5d95bbe0f640f6ed/metadata.rb
  git add cookbooks/chef-sugar/metadata.rb
  git commit -m "Adds a metadata.rb to chef-sugar"
  knife cookbook site install openssl

Please note, I'm not pulling the latest metadata.rb from the chef-sugar repo on GitHub. Doing so would fail.

@nathenharvey
Copy link
Contributor

The issue here is that the cookbook is being published in a way that's not supported by knife cookbook site install.

Stove was used to publish the chef-sugar cookbook to the Supermarket. Since version 3.2.3, Stove no longer publishes a metadata.rb only the compiled version (metadata.json). This is the the proper behavior for the producer but the consumer (knife cookbook site install) is broken in this case because it has a dependency on the metadata.rb file.

A fix to knife has been recommended and is currently being discussed. I've verified that this fix will resolve this issue.

The best workaround that I can come up with for now is to manually create and commit a metadata.rb to the chef-sugar cookbook:

  knife cookbook site install openssl
  wget --quiet -O cookbooks/chef-sugar/metadata.rb https://gist.githubusercontent.com/nathenharvey/8080ed328a37cea92ad2/raw/596870cfabe8558bae34f6ae5d95bbe0f640f6ed/metadata.rb
  git add cookbooks/chef-sugar/metadata.rb
  git commit -m "Adds a metadata.rb to chef-sugar"
  knife cookbook site install openssl

@charlesjohnson
Copy link
Contributor

Just tested this with Chef 12.0.3, and knife cookbook site install openssl now appears to work as intended.

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

No branches or pull requests

3 participants