Issue uploading cookbooks to new server


#1

I’m trying to upload a new cookbook to a new server, and each time it fails
with

steevmi1::nrusca-ldl30006$ knife cookbook upload test
Uploading test [0.1.0]
ERROR: Method Not Allowed
Response:
steevmi1::nrusca-ldl30006$

If I run with --verbose --verbose, I’m getting back a 405 error:

steevmi1::nrusca-ldl30006$ knife cookbook upload test --verbose --verbose
DEBUG: Signing the request as steevmi1
DEBUG: Sending HTTP Request via GET to
ip-10-145-88-6.dom.ain.net:80/environments/_default
DEBUG: ---- HTTP Status and Header Data: ----
DEBUG: HTTP 1.1 301 Moved Permanently
DEBUG: server: nginx/1.2.3
DEBUG: date: Mon, 15 Apr 2013 20:11:43 GMT
DEBUG: content-type: text/html
DEBUG: content-length: 184
DEBUG: connection: close
DEBUG: location: https://ip-10-145-88-6.dom.ain.net/environments/_default
DEBUG: ---- End HTTP Status/Header Data ----
DEBUG: Following redirect 1/10
DEBUG: Signing the request as steevmi1
DEBUG: Sending HTTP Request via GET to
ip-10-145-88-6.dom.ain.net:443/environments/_default
DEBUG: ---- HTTP Status and Header Data: ----
DEBUG: HTTP 1.1 200 OK
DEBUG: server: nginx/1.2.3
DEBUG: date: Mon, 15 Apr 2013 20:11:44 GMT
DEBUG: content-type: application/json
DEBUG: transfer-encoding: chunked
DEBUG: connection: close
DEBUG: x-ops-api-info: flavor=osc;version=11.0.2;erchef=1.2.6
DEBUG: content-encoding: gzip
DEBUG: ---- End HTTP Status/Header Data ----
DEBUG: decompressing gzip response
DEBUG: Signing the request as steevmi1
DEBUG: Sending HTTP Request via GET to ip-10-145-88-6.dom.ain.net:80/cookbooks
DEBUG: ---- HTTP Status and Header Data: ----
DEBUG: HTTP 1.1 301 Moved Permanently
DEBUG: server: nginx/1.2.3
DEBUG: date: Mon, 15 Apr 2013 20:11:44 GMT
DEBUG: content-type: text/html
DEBUG: content-length: 184
DEBUG: connection: close
DEBUG: location: https://ip-10-145-88-6.dom.ain.net/cookbooks?num_versions=all
DEBUG: ---- End HTTP Status/Header Data ----
DEBUG: Following redirect 1/10
DEBUG: Signing the request as steevmi1
DEBUG: Sending HTTP Request via GET to ip-10-145-88-6.dom.ain.net:443/cookbooks
DEBUG: ---- HTTP Status and Header Data: ----
DEBUG: HTTP 1.1 200 OK
DEBUG: server: nginx/1.2.3
DEBUG: date: Mon, 15 Apr 2013 20:11:44 GMT
DEBUG: content-type: application/json
DEBUG: content-length: 2
DEBUG: connection: close
DEBUG: x-ops-api-info: flavor=osc;version=11.0.2;erchef=1.2.6
DEBUG: ---- End HTTP Status/Header Data ----
DEBUG: No chefignore file found at
/home/steevmi1/Library/Chef/cookbooks/chefignore no files will be ignored
Uploading test [0.1.0]
INFO: Validating ruby files
DEBUG: Ruby file /home/steevmi1/Library/Chef/cookbooks/test/metadata.rb is
unchanged, skipping syntax check
DEBUG: Ruby file /home/steevmi1/Library/Chef/cookbooks/test/recipes/default.rb
is unchanged, skipping syntax check
INFO: Validating templates
INFO: Syntax OK
INFO: Saving test
DEBUG: Signing the request as steevmi1
DEBUG: Sending HTTP Request via POST to ip-10-145-88-6.dom.ain.net:80/sandboxes
DEBUG: ---- HTTP Status and Header Data: ----
DEBUG: HTTP 1.1 301 Moved Permanently
DEBUG: server: nginx/1.2.3
DEBUG: date: Mon, 15 Apr 2013 20:11:44 GMT
DEBUG: content-type: text/html
DEBUG: content-length: 184
DEBUG: connection: close
DEBUG: location: https://ip-10-145-88-6.dom.ain.net/sandboxes
DEBUG: ---- End HTTP Status/Header Data ----
DEBUG: Following redirect 1/10
DEBUG: Signing the request as steevmi1
DEBUG: Sending HTTP Request via GET to ip-10-145-88-6.dom.ain.net:443/sandboxes
DEBUG: ---- HTTP Status and Header Data: ----
DEBUG: HTTP 1.1 405 Method Not Allowed
DEBUG: server: nginx/1.2.3
DEBUG: date: Mon, 15 Apr 2013 20:11:44 GMT
DEBUG: content-length: 0
DEBUG: connection: close
DEBUG: x-ops-api-info: flavor=osc;version=11.0.2;erchef=1.2.6
DEBUG: allow: POST
DEBUG: ---- End HTTP Status/Header Data ----
/home/steevmi1/PROG/lib/ruby/1.9.1/net/http.rb:2632:in error!': 405 "Method Not Allowed" (Net::HTTPServerException) from /home/steevmi1/PROG/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:199:inblock in raw_http_request’
from
/home/steevmi1/PROG/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:280:in
retriable_rest_request' from /home/steevmi1/PROG/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:164:inraw_http_request’
from
/home/steevmi1/PROG/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:158:in
api_request' from /home/steevmi1/PROG/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:188:inblock (2 levels) in raw_http_request’
from
/home/steevmi1/PROG/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:333:in
follow_redirect' from /home/steevmi1/PROG/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:188:inblock in raw_http_request’
from
/home/steevmi1/PROG/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:280:in
retriable_rest_request' from /home/steevmi1/PROG/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:164:inraw_http_request’
from
/home/steevmi1/PROG/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:158:in
api_request' from /home/steevmi1/PROG/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:118:inpost’
from
/home/steevmi1/PROG/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/cookbook_uploader.rb:71:in
upload_cookbooks' from /home/steevmi1/PROG/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/knife/cookbook_upload.rb:230:inupload’
from
/home/steevmi1/PROG/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/knife/cookbook_upload.rb:121:in
block in run' from /home/steevmi1/PROG/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/knife/cookbook_upload.rb:118:ineach’
from
/home/steevmi1/PROG/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/knife/cookbook_upload.rb:118:in
run' from /home/steevmi1/PROG/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/knife.rb:460:inrun_with_pretty_exceptions’
from
/home/steevmi1/PROG/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/knife.rb:173:in
run' from /home/steevmi1/PROG/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/application/knife.rb:123:inrun’
from
/home/steevmi1/PROG/lib/ruby/gems/1.9.1/gems/chef-11.4.0/bin/knife:25:in <top (required)>' from /home/steevmi1/PROG/bin/knife:23:inload’
from /home/steevmi1/PROG/bin/knife:23:in `’

Not really sure what is going on here?

-Mike


#2

On Monday, April 15, 2013 at 1:15 PM, steeves@raingods.net wrote:

I’m trying to upload a new cookbook to a new server, and each time it fails
with

steevmi1::nrusca-ldl30006$ knife cookbook upload test
Uploading test [0.1.0]
ERROR: Method Not Allowed
Response:
steevmi1::nrusca-ldl30006$

Your chef_server_url should be https instead of http.

Chef currently follows redirects by turning anything other than a GET (e.g., PUT/POST) into a GET, based on a common misinterpretation of the HTTP 1.0 RFC. We’ve accepted a patch to Chef that will change this behavior so that redirects on non-GET requests will fail with a sensible error message.


Daniel DeLeo


#3

On 4/15/13 4:22 PM, Daniel DeLeo wrote:

On Monday, April 15, 2013 at 1:15 PM, steeves@raingods.net wrote:

I’m trying to upload a new cookbook to a new server, and each time it
fails
with

steevmi1::nrusca-ldl30006$ knife cookbook upload test
Uploading test [0.1.0]
ERROR: Method Not Allowed
Response:
steevmi1::nrusca-ldl30006$
Your chef_server_url should be https instead of http.

Chef currently follows redirects by turning anything other than a GET
(e.g., PUT/POST) into a GET, based on a common misinterpretation of the
HTTP 1.0 RFC. We’ve accepted a patch to Chef that will change this
behavior so that redirects on non-GET requests will fail with a sensible
error message.

Fantastic – switched the URL to https in my knife.rb, and was able to
upload the cookbook.

Thanks again for the quick response.

-Mike

Michael Steeves (steeves@raingods.net)