I have a cookbook that uses a remote file resource to get a file from an nginx file server, like this. The server is NOT configured for gzip-like compression.
remote_file “/tmp/vcredist_x64-1.0.2013.exe” do
source " http://nginx-server/path/ vcredist_x64-1.0.2013.exe "
end
When I run it I get…
================================================================================
Error executing action create
on resource ‘remote_file[c:\windows\temp\chef-client\vcredist_x64-1.0.2013.exe]’
Chef::Exceptions::ContentLengthMismatch
Response body length 1592008 does not match HTTP Content-Length header 2155670.
What’s strange is this has been working, and my cookbook has NOT changed in months. I did upgrade to chef-client 12.3.0, so I tried 12.2.1, but that gives the same error.
Any clues?
Sounds kinda like one that I ran into awhile back:
http://lists.opscode.com/sympa/arc/chef/2015-01/msg00381.html
Some more details here:
opened 11:23PM - 27 Jan 15 UTC
closed 06:48PM - 28 Jan 15 UTC
I have plugins uploaded to S3 and I'm running into this quite frequently. Not su… re if it's an issue with S3 or what, I was able to curl the URL and download it on my machine, and the sha256 matches the [official one](http://updates.jenkins-ci.org/download/plugins/git-client/1.12.0/git-client.hpi). Other remote_file uses in this chef run that hit this same bucket don't have any issue. This is running on a local VirtualBox VM via Vagrant. Any ideas?
```
==> default: Resource Declaration:
==> default: ---------------------
==> default: # In /tmp/vagrant-chef-3/chef-solo-1/cookbooks/mycorp-jenkins/recipes/jenkins_plugins.rb
==> default:
==> default: 15: jenkins_plugin plugin["name"] do
==> default: 16: source "#{node['mycorp-jenkins']['plugin_source_url']}/#{plugin['name']}/#{plugin['version']}/#{plugin['name']}.hpi"
==> default: 17: version plugin["version"]
==> default:
==> default: 18: install_deps false
==> default: 19: end
==> default: 20: end
==> default:
==> default: Compiled Resource:
==> default: ------------------
==> default: # Declared in /tmp/vagrant-chef-3/chef-solo-1/cookbooks/mycorp-jenkins/recipes/jenkins_plugins.rb:15:in `block in from_file'
==> default:
==> default:
==> default: jenkins_plugin("git-client") do
==> default: action :install
==> default: retries 0
==> default: retry_delay 2
==> default: guard_interpreter :default
==> default: cookbook_name :"mycorp-jenkins"
==> default: recipe_name "jenkins_plugins"
==> default: source "https://s3-us-west-1.amazonaws.com/my-bucket/jenkins-plugins/git-client/1.12.0/git-client.hpi"
==> default: version "1.12.0"
==> default: end
==> default:
==> default:
==> default:
==> default: [2015-01-27T22:31:00+00:00] INFO: Running queued delayed notifications before re-raising exception
==> default: [2015-01-27T22:31:00+00:00] DEBUG: Re-raising exception: Chef::Exceptions::ContentLengthMismatch - jenkins_plugin[git-client] (mycorp-jenkins:
:jenkins_plugins line 15) had an error: Chef::Exceptions::ContentLengthMismatch: remote_file[/var/chef/cache/jenkins-cli.jar] (dynamically defined) had an error
: Chef::Exceptions::ContentLengthMismatch: Response body length 179864 does not match HTTP Content-Length header 751490.
==> default: /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/http/validate_content_length.rb:102:in `validate'
==> default: /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/http/validate_content_length.rb:60:in `handle_stream_complete'
==> default: /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/http.rb:236:in `block in apply_stream_complete_middleware'
==> default: /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/http.rb:234:in `each'
==> default: /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/http.rb:234:in `inject'
==> default: /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/http.rb:234:in `apply_stream_complete_middleware'
==> default: /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/http.rb:174:in `block in streaming_request'
==> default: /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.16.2/lib/chef/http/basic_client.rb:74:in `block in request'
```
Double check your nginx error log to see if something similar is occurring
Greg
On Fri, May 15, 2015 at 3:52 PM, Fouts, Chris Chris.Fouts@sensus.com
wrote:
I have a cookbook that uses a remote file resource to get a file from an
nginx file server, like this. The server is NOT configured for gzip-like
compression.
remote_file "/tmp/vcredist_x64-1.0.2013.exe" do
source " http://nginx-server/path/ vcredist_x64-1.0.2013.exe "
end
When I run it I get…
================================================================================
Error executing action create
on resource
'remote_file[c:\windows\temp\chef-client\vcredist_x64-1.0.2013.exe]'
================================================================================
Chef::Exceptions::ContentLengthMismatch
Response body length 1592008 does not match HTTP Content-Length header
2155670.
What’s strange is this has been working, and my cookbook has NOT changed
in months. I did upgrade to chef-client 12.3.0, so I tried 12.2.1, but that
gives the same error.
Any clues?