chef / supermarket

Chef's community platform
https://supermarket.chef.io/
Apache License 2.0
214 stars 113 forks source link

Cookbook uploads fail because categories don't exist (Inside The Firewall) #812

Closed echohack closed 10 years ago

echohack commented 10 years ago

Hey there,

If you stand up a fresh Supermarket server, there's no way to upload cookbooks to it, due to a Category not existing out of the box.

I'm using @cwebberOps 's knife-supermarket with custom configuration in my knife.rb to point to my internal supermarket server.

$ knife supermarket share my-face "Other"
Generating metadata for my-face from /var/folders/m6/y11btst14nx39fkfnbhh2zp00000gn/T/chef-my-face-build20140917-1363-1mpox5e/my-face/metadata.rb
Making tarball my-face.tgz
ERROR: Category 'Other' does not exist.

I've tried several workarounds, such as attempting to connect to the Postgres database directly or use the RESTapi to do a POST request, but these are so badly documented that I can't really figure it out:

I can't find anywhere where the Postgres database connection information is located for manually editing the data... :|

https://docs.getchef.com/api_cookbooks_site.html Doesn't mention how to format the post request. I've tried giving it json data with {"Category": "Other"} and a tar.gz with the cookbook formatted as a multi-part file upload, but this gives me a 500. :(

I'm not familiar enough to make a judgement call on what the resolution should be (I've seen a couple of other closed issues mentioning removing Categories? #671 #411 ), but my guess would be one or more of the following:

cwebberOps commented 10 years ago

@echohack I am actually going to look at just removing the category requirement from knife-supermarket

echohack commented 10 years ago

Brilliant @cwebberOps. I would be happy to test any changes for you.

raskchanky commented 10 years ago

@echohack Thanks for opening this issue. This is definitely not a delightful experience out of the box, and I'm sorry about that. I know that categories were a requirement in the past, and off the cuff, I want to say that knife might require them. Regardless, I'll look into what it will take to make this work out of the box.

echohack commented 10 years ago

Tested @raskchanky's change locally on our internal Supermarket sandbox server by merging his pull request into my own supermarket repo and changing my supermarket.json data bag and uploading it to the chef server.

supermarket.json

{
  "id": "supermarket",
  "description": "This is an example data bag that is used to standup Supermarket if you use this please please please change the default values for security sake.",
  "secret_key_base": "",
  "repository": "https://github.com/echohack/supermarket.git",
...

The change works beautifully. I'm using the knife-supermarket plugin:

$ knife supermarket share my-face Other
Generating metadata for my-face from /var/folders/m6/y11btst14nx39fkfnbhh2zp00000gn/T/chef-my-face-build20140922-6969-klaeqt/my-face/metadata.rb
Making tarball my-face.tgz
Upload complete!

I'm going to do a pull request for some documentation on the deployment document and then I'll close this issue.

raskchanky commented 10 years ago

@echohack Awesome! Glad to hear it worked well.

echohack commented 10 years ago

Updated https://github.com/opscode/supermarket/wiki/Deployment with some more info about how to test your deployment.

This issue is resolved.