0
votes

I am running chef bootstrap command from chef server on target node. Script runs fine for initial recipes but as it progress we are seeing 403 forbidden and it exits. This 403 is happening only when it is trying to copy file from template folder. I have seen same issue when i was executing another recipe as well.

There is no issue with recipe as same cookbook run with out issues on different target node.

Anyone know how to resolve this?

Error executing action `create` on resource 'template[/tmp/rsp_files/WebGate_Installation_response_file.rsp]'
     ================================================================================

     Net::HTTPServerException
     ------------------------
     403 "Forbidden"

     Resource Declaration:
     ---------------------
     # In /var/chef/cache/cookbooks/ohs/recipes/install_webgate.rb

      59: template "#{node['OHS']['RSP_FILE']}/WebGate_Installation_response_file.rsp" do
      60:   source 'WebGate_Installation_response_file.rsp.erb'
      61:   owner node['OHS']['USER']
      62:   group node['OHS']['GROUP']
      63:   mode '0644'
      64:   not_if do ::File.exists?("#{node['OHS']['RSP_FILE']}/WebGate_Installation_response_file.rsp") end
      65: end
      66:

     Compiled Resource:
     ------------------
     # Declared in /var/chef/cache/cookbooks/ohs/recipes/install_webgate.rb:59:in `from_file'

     template("/tmp/rsp_files/WebGate_Installation_response_file.rsp") do
       provider Chef::Provider::Template
       action "create"
       retries 0
       retry_delay 2
       guard_interpreter :default
       path "/tmp/rsp_files/WebGate_Installation_response_file.rsp"
       backup 5
       atomic_update true
       source "WebGate_Installation_response_file.rsp.erb"
       cookbook_name "ohs"
       recipe_name "install_webgate"
       owner "oracle"
       group "oinstall"
       mode "0644"
       not_if { #code block }
     end


 Running handlers:
 [2016-05-31T17:21:45-04:00] ERROR: Running exception handlers
 Running handlers complete
 [2016-05-31T17:21:45-04:00] ERROR: Exception handlers complete
 [2016-05-31T17:21:45-04:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
 Chef Client failed. 23 resources updated in 929.166495413 seconds
 [2016-05-31T17:21:45-04:00] ERROR: template[/tmp/rsp_files/WebGate_Installation_response_file.rsp] (ohs::install_webgate line 59) had an error: Net::HTTPServerException: 403 "Forbidden"
 [2016-05-31T17:21:45-04:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
2
What version of Chef are you using? - coderanger
Does your run take a very long time? I think 11.14 is about the time when we had lazy loading of template files enabled by default so it is possible for the URL signatures to expire during very long runs. You can fix this by setting no_lazy_load to true in your client.rb. - coderanger
Can you let me know where to add no_lazy_load? Is it on chef-client side or at chef-server? I don't have recipe as client.rb. - user2961454

2 Answers

1
votes

Add no_lazy_load true to /etc/chef/client.rb. Alternatively upgrade to a more recent Chef version where we fixed this by making that config options the default value.

0
votes

As per the suggestion in Chef Docs, this error can be resolved in another way.

Try to add the below mentioned Chef server config value (in chef-server.rb or private-chef.rb file)

opscode_erchef['s3_url_ttl'] = 3600

Chef Docs description states the below,

opscode_erchef['s3_url_ttl']

The amount of time (in seconds) before connections to the server expire. If chef-client runs are timing out, increase this setting to 3600, and then adjust again if necessary. Default value: 900.

This solution can be useful, in case switching to newer version of Chef is not possible in near future.

OR

If it is difficult to add the client.rb option, due to larger volume of servers.

Note: Adding the option in config file, requires to perform reconfigure in Chef server.