Chef Cookbook Compilation Error While Bootstrapping The Node


#1

I am using chef to bootstrap a node. I have created encrypted data bags and
copied the secret key on the node as /etc/chef/encrypted_data_bag_secret.

When I try to bootstrap the node, I am getting the following error:

================================================================================
Recipe Compile Error in
/var/chef/cache/cookbooks/webapps-configs/recipes/httpd.rb

Net::HTTPServerException

404 "Not Found"
Cookbook Trace:

/var/chef/cache/cookbooks/webapps-configs/recipes/httpd.rb:12:in `from_file’
Relevant File Content:

/var/chef/cache/cookbooks/webapps-configs/recipes/httpd.rb:

10:
11: CHEF_ENV = node.chef_environment
12>> http_ssl_creds = Chef::EncryptedDataBagItem.load("#{CHEF_ENV}",
“http-ssl”)
13: PRIVATE_KEY = http_ssl_creds[“private_key”]
14: CHAIN_FILE= http_ssl_creds[“chain_file”]
15: CERT= http_ssl_creds[“cert”]
16:

ERROR: Running exception handlers
FATAL: Saving node information to /var/chef/cache/failed-run-data.json
ERROR: Exception handlers complete
Chef Client failed. 0 resources updated
FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
FATAL: Net::HTTPServerException: 404 "Not Found"
Here is the stack trace:

Net::HTTPServerException: 404 “Not Found”
/opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:2632:in error!' /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:199:inblock in raw_http_request’
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:280:in
retriable_rest_request' /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:164:inraw_http_request’
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:158:in
api_request' /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:99:inget’
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/data_bag_item.rb:149:in
load' /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/encrypted_data_bag_item.rb:294:inload’
/var/chef/cache/cookbooks/webapps-configs/recipes/httpd.rb:12:in from_file' /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/mixin/from_file.rb:30:ininstance_eval’
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/mixin/from_file.rb:30:in
from_file' /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/cookbook_version.rb:346:inload_recipe’
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/run_context.rb:151:in
load_recipe' /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/run_context/cookbook_compiler.rb:139:inblock in compile_recipes’
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/run_context/cookbook_compiler.rb:137:in
each' /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/run_context/cookbook_compiler.rb:137:incompile_recipes’
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/run_context/cookbook_compiler.rb:74:in
compile' /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/run_context.rb:86:inload’
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/client.rb:224:in
setup_run_context' /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/client.rb:467:indo_run’
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/client.rb:200:in
run' /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/application.rb:190:inrun_chef_client’
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/application/client.rb:297:in
block in run_application' /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/application/client.rb:290:inloop’
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/application/client.rb:290:in
run_application' /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/application.rb:73:inrun’
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/bin/chef-client:26:in
<top (required)>' /usr/bin/chef-client:23:inload’
/usr/bin/chef-client:23:in `’

Any help or pointers?


#2

the httpd recipe in webapps-configs cookbook trying to access a data bag
with the name same as the node’s chef environment and item name as
’'http-ssl" , and not able to retrieve it. Check manually if you have that
databag item. i.e. knife data bag show "node env" http-ssl --secret-file FILE is showing something

On Wed, Mar 13, 2013 at 2:25 AM, Mahrob Hijazim mahrobiyat@gmail.comwrote:

I am using chef to bootstrap a node. I have created encrypted data bags and
copied the secret key on the node as /etc/chef/encrypted_data_bag_secret.

When I try to bootstrap the node, I am getting the following error:

================================================================================
Recipe Compile Error in
/var/chef/cache/cookbooks/webapps-configs/recipes/httpd.rb

================================================================================
Net::HTTPServerException

404 "Not Found"
Cookbook Trace:

/var/chef/cache/cookbooks/webapps-configs/recipes/httpd.rb:12:in
`from_file’
Relevant File Content:

/var/chef/cache/cookbooks/webapps-configs/recipes/httpd.rb:

10:
11: CHEF_ENV = node.chef_environment
12>> http_ssl_creds = Chef::EncryptedDataBagItem.load("#{CHEF_ENV}",
“http-ssl”)
13: PRIVATE_KEY = http_ssl_creds[“private_key”]
14: CHAIN_FILE= http_ssl_creds[“chain_file”]
15: CERT= http_ssl_creds[“cert”]
16:

ERROR: Running exception handlers
FATAL: Saving node information to /var/chef/cache/failed-run-data.json
ERROR: Exception handlers complete
Chef Client failed. 0 resources updated
FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
FATAL: Net::HTTPServerException: 404 "Not Found"
Here is the stack trace:

Net::HTTPServerException: 404 “Not Found”
/opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:2632:in `error!’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:199:in
`block in raw_http_request’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:280:in
`retriable_rest_request’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:164:in
`raw_http_request’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:158:in
`api_request’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:99:in
`get’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/data_bag_item.rb:149:in
`load’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/encrypted_data_bag_item.rb:294:in
load' /var/chef/cache/cookbooks/webapps-configs/recipes/httpd.rb:12:infrom_file’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/mixin/from_file.rb:30:in
`instance_eval’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/mixin/from_file.rb:30:in
`from_file’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/cookbook_version.rb:346:in
`load_recipe’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/run_context.rb:151:in
`load_recipe’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/run_context/cookbook_compiler.rb:139:in
`block in compile_recipes’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/run_context/cookbook_compiler.rb:137:in
`each’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/run_context/cookbook_compiler.rb:137:in
`compile_recipes’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/run_context/cookbook_compiler.rb:74:in
`compile’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/run_context.rb:86:in
`load’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/client.rb:224:in
`setup_run_context’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/client.rb:467:in
`do_run’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/client.rb:200:in
`run’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/application.rb:190:in
`run_chef_client’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/application/client.rb:297:in
`block in run_application’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/application/client.rb:290:in
`loop’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/application/client.rb:290:in
`run_application’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/application.rb:73:in
`run’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/bin/chef-client:26:in
<top (required)>' /usr/bin/chef-client:23:inload’
/usr/bin/chef-client:23:in `’

Any help or pointers?


#3

Thanks for the response, yes I verified both encrypted and de-crypted
values, and those shows up properly.

The following command was used:

knife data bag show test-env http-ssl

-Mahrob

On Wed, Mar 13, 2013 at 5:25 PM, Ranjib Dey dey.ranjib@gmail.com wrote:

the httpd recipe in webapps-configs cookbook trying to access a data bag
with the name same as the node’s chef environment and item name as
’'http-ssl" , and not able to retrieve it. Check manually if you have that
databag item. i.e. knife data bag show "node env" http-ssl --secret-file FILE is showing something

On Wed, Mar 13, 2013 at 2:25 AM, Mahrob Hijazim mahrobiyat@gmail.comwrote:

I am using chef to bootstrap a node. I have created encrypted data bags
and
copied the secret key on the node as /etc/chef/encrypted_data_bag_secret.

When I try to bootstrap the node, I am getting the following error:

================================================================================
Recipe Compile Error in
/var/chef/cache/cookbooks/webapps-configs/recipes/httpd.rb

================================================================================
Net::HTTPServerException

404 "Not Found"
Cookbook Trace:

/var/chef/cache/cookbooks/webapps-configs/recipes/httpd.rb:12:in
`from_file’
Relevant File Content:

/var/chef/cache/cookbooks/webapps-configs/recipes/httpd.rb:

10:
11: CHEF_ENV = node.chef_environment
12>> http_ssl_creds = Chef::EncryptedDataBagItem.load("#{CHEF_ENV}",
“http-ssl”)
13: PRIVATE_KEY = http_ssl_creds[“private_key”]
14: CHAIN_FILE= http_ssl_creds[“chain_file”]
15: CERT= http_ssl_creds[“cert”]
16:

ERROR: Running exception handlers
FATAL: Saving node information to /var/chef/cache/failed-run-data.json
ERROR: Exception handlers complete
Chef Client failed. 0 resources updated
FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
FATAL: Net::HTTPServerException: 404 "Not Found"
Here is the stack trace:

Net::HTTPServerException: 404 “Not Found”
/opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:2632:in `error!’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:199:in
`block in raw_http_request’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:280:in
`retriable_rest_request’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:164:in
`raw_http_request’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:158:in
`api_request’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:99:in
`get’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/data_bag_item.rb:149:in
`load’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/encrypted_data_bag_item.rb:294:in
load' /var/chef/cache/cookbooks/webapps-configs/recipes/httpd.rb:12:infrom_file’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/mixin/from_file.rb:30:in
`instance_eval’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/mixin/from_file.rb:30:in
`from_file’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/cookbook_version.rb:346:in
`load_recipe’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/run_context.rb:151:in
`load_recipe’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/run_context/cookbook_compiler.rb:139:in
`block in compile_recipes’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/run_context/cookbook_compiler.rb:137:in
`each’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/run_context/cookbook_compiler.rb:137:in
`compile_recipes’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/run_context/cookbook_compiler.rb:74:in
`compile’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/run_context.rb:86:in
`load’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/client.rb:224:in
`setup_run_context’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/client.rb:467:in
`do_run’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/client.rb:200:in
`run’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/application.rb:190:in
`run_chef_client’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/application/client.rb:297:in
`block in run_application’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/application/client.rb:290:in
`loop’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/application/client.rb:290:in
`run_application’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/application.rb:73:in
`run’

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/bin/chef-client:26:in
<top (required)>' /usr/bin/chef-client:23:inload’
/usr/bin/chef-client:23:in `’

Any help or pointers?