chef recipe calls out chef::http works fine locally using chef-dk. same recipe not work when run via aws opsworks/chef 12 on ubuntu 14 instance.
response = chef::http.new(node["api-url"]).get(uri, headers)
the message
========================================================================
recipe compile error in /var/chef/runs/65a23b46-bca7-49fd-a467-bdbeee64b746/local-mode-cache/cache/cookbooks/???/recipes/???.rb
net::httpserverexception
404 "not found"
22>> response = chef::http.new(node["api-url"]).get(uri, headers)
i pretty sure because not recognize chef::http not sure how fix it.
update: here's stacktrace - missing - continue look.
generated @ 2017-04-06 15:30:30 +0000 net::httpserverexception: 412 "precondition failed" /opt/chef/embedded/lib/ruby/2.3.0/net/http/response.rb:120:in error!' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/http.rb:150:in
request' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/http.rb:131:in post' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/policy_builder/expand_node_object.rb:204:in
sync_cookbooks' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/policy_builder/expand_node_object.rb:83:in setup_run_context' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/client.rb:511:in
setup_run_context' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/client.rb:281:in run' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/application.rb:295:in
block in fork_chef_client' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/application.rb:283:in fork' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/application.rb:283:in
fork_chef_client' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/application.rb:248:in block in run_chef_client' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/local_mode.rb:44:in
with_server_connectivity' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/application.rb:236:in run_chef_client' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/application/client.rb:464:in
sleep_then_run_chef_client' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/application/client.rb:451:in block in interval_run_chef_client' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/application/client.rb:450:in
loop' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/application/client.rb:450:in interval_run_chef_client' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/application/client.rb:434:in
run_application' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/application.rb:59:in run' /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/bin/chef-client:26:in
' /opt/chef/bin/chef-client:57:in load' /opt/chef/bin/chef-client:57:in
'
Comments
Post a Comment