Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm running Chef server 11 on a CentOS 6 box. Installed via the RPM from Opscode. I set up my workstation on a Windows 7 box. I can run the usual knife client list and get a response, so I'm confident that my server is working correctly.

I created a local Git repo on the workstation, added the getting-started cookbook, and committed it to the local repo (on local disk on the workstation).

When I try to upload the cookbook, though:

knife cookbook upload getting-started
Uploading getting-started [0.4.0]
ERROR: Method Not Allowed
Response:

The 'Response' is empty. When I try a knife cookbook list, I get back an empty set. I imagine that's because it's fetching it from the server, which doesn't have the cookbook yet.

I saw this post on the old Opscode wiki, which lead me to believe that I'm trying to edit the _default environment. So created a Dev environment, confirmed it existed, and:

knife cookbook upload getting-started -E Dev

Same result. My last resort was to specify an admin account:

knife cookbook upload getting-started -E Dev -u admin

Same result.

What do I need to do in order to successfully upload this cookbook?

share|improve this question

3 Answers 3

up vote 4 down vote accepted

I had this same issue from a default install. Turns out the knife.rb needed https:// instead of http:// in the server url as well.

share|improve this answer
    
Ah! That would explain why the redirect. And getting the hostname (instead of the fqdn) makes sense now. Thanks! –  drawsmcgraw Feb 9 '13 at 12:09

I also received this error when I attempted to upload a chef role from a local json file but had properties missing in my local json. When I used extra verbosity mode I saw that knife was attempting an HTTP PUT operation and received the HTTP 405 Method Not Allowed response.

So it seems that the "Method Not Allowed" error basically means that knife submitted an HTTP request that the Chef server did not understand.

To fix my issue with the role, once I used the correct role format (shown below), it worked fine.

{
    "name": "my role name",
    "description": "my role description",
    "chef_type": "role",
    "json_class": "Chef::Role",
    "run_list": [ 
              "recipe[recipe1]", 
              "recipe[recipe2]"
           ],
    "default_attributes": {},
    "override_attributes": {}
}
share|improve this answer

The "Method Not Allowed" error is actually an HTTP 405 error. I didn't know that. Turns out I had some odd redirection on my Chef server. I would address the server by its FQDN but get redirected to the hostname. I turned on 'extra' verbosity:

knife cookbook upload getting-started -V -V

And the debug messages let me know that the initial upload was getting an HTTP 301 (Permanently Moved). When knife tried to hit the new address, it would use a GET instead of a POST, causing the 405. I configured knife to point to the redirected URL and the upload was a success.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.