aririikonen / oracle

Full Oracle cookbook for Chef. Please see the README.md for further details.
http://oraarir.blogspot.fi/
44 stars 50 forks source link

Recipe Compile Error in /var/chef/cache/cookbooks/oracle/recipes/default.rb #13

Open samriddhip opened 8 years ago

samriddhip commented 8 years ago

Net::HTTPServerException

404 "Object Not Found"

Hi, I am facing this compilation error when I run chef-client on my node. Could you help?

aririikonen commented 8 years ago

Would you have further information on this case? Output, logfiles, what do you see and experience?

MichaelPereira commented 8 years ago

Hello,

I am hitting the same issue when running chef-client. Here is the relevant debug output:

2016-03-01T20:41:15+00:00] DEBUG: Backtrace entry for compile error: '/var/chef/cache/cookbooks/oracle/recipes/oracle_user_config.rb:70:in `from_file''
[2016-03-01T20:41:15+00:00] DEBUG: Line number of compile error: '70'

================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/oracle/recipes/default.rb
================================================================================

Net::HTTPServerException
------------------------
404 "Object Not Found"

Cookbook Trace:
---------------
  /var/chef/cache/cookbooks/oracle/recipes/oracle_user_config.rb:70:in `from_file'
  /var/chef/cache/cookbooks/oracle/recipes/default.rb:21:in `from_file'

Relevant File Content:
----------------------
/var/chef/cache/cookbooks/oracle/recipes/oracle_user_config.rb:

 63:    cwd '/home/oracle'
 64:    creates '/home/oracle/.dir_colors'
 65:    only_if {node[:oracle][:user][:shell] != '/bin/bash'}
 66:  end
 67:  
 68:  # Set the oracle user's password.
 69:  unless node[:oracle][:user][:pw_set]
 70>>   ora_edb_item = Chef::EncryptedDataBagItem.load(node[:oracle][:user][:edb], node[:oracle][:user][:edb_item])
 71:    ora_pw = ora_edb_item['pw']
 72:  
 73:    # Note that output formatter will display the password on your terminal.
 74:    execute 'change_oracle_user_pw' do
 75:      command "echo oracle:#{ora_pw} | /usr/sbin/chpasswd"
 76:    end
 77:    
 78:    ruby_block 'set_pw_attr' do
 79:      block do

[2016-03-01T20:41:15+00:00] DEBUG: Re-raising exception: Net::HTTPServerException - 404 "Object Not Found"
/opt/chef/embedded/lib/ruby/2.1.0/net/http/response.rb:119:in `error!'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/http.rb:145:in `request'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/http.rb:110:in `get'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/data_bag_item.rb:155:in `load'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/encrypted_data_bag_item.rb:123:in `load'
  /var/chef/cache/cookbooks/oracle/recipes/oracle_user_config.rb:70:in `from_file'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/mixin/from_file.rb:30:in `instance_eval'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/mixin/from_file.rb:30:in `from_file'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/cookbook_version.rb:229:in `load_recipe'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context.rb:332:in `load_recipe'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context.rb:288:in `block in include_recipe'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context.rb:287:in `each'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context.rb:287:in `include_recipe'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/dsl/include_recipe.rb:26:in `include_recipe'
  /var/chef/cache/cookbooks/oracle/recipes/default.rb:21:in `from_file'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/mixin/from_file.rb:30:in `instance_eval'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/mixin/from_file.rb:30:in `from_file'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/cookbook_version.rb:229:in `load_recipe'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context.rb:332:in `load_recipe'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context/cookbook_compiler.rb:140:in `block in compile_recipes'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context/cookbook_compiler.rb:138:in `each'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context/cookbook_compiler.rb:138:in `compile_recipes'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context/cookbook_compiler.rb:75:in `compile'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context.rb:167:in `load'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/policy_builder/expand_node_object.rb:93:in `setup_run_context'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/client.rb:509:in `setup_run_context'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/client.rb:277:in `run'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application.rb:270:in `block in fork_chef_client'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application.rb:258:in `fork'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application.rb:258:in `fork_chef_client'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application.rb:223:in `block in run_chef_client'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/local_mode.rb:44:in `with_server_connectivity'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application.rb:211:in `run_chef_client'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application/client.rb:433:in `block in interval_run_chef_client'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application/client.rb:423:in `loop'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application/client.rb:423:in `interval_run_chef_client'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application/client.rb:412:in `run_application'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application.rb:58:in `run'
  /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/bin/chef-client:26:in `<top (required)>'
  /usr/bin/chef-client:50:in `load'
  /usr/bin/chef-client:50:in `<main>'

When looking at the implementation details of the line 70, it looks like it is trying to load non-existing items from the data bag on the chef server

# File 'lib/chef/data_bag_item.rb', line 191

def self.load(data_bag, name)
  if Chef::Config[:solo]
    bag = Chef::DataBag.load(data_bag)
    item = bag[name]
  else
    item = Chef::REST.new(Chef::Config[:chef_server_url]).get_rest("data/#{data_bag}/#{name}")
  end

  if item.kind_of?(DataBagItem)
    item
  else
    item = from_hash(item)
    item.data_bag(data_bag)
    item
  end
end
MichaelPereira commented 8 years ago

I guess that everyone stops reading the README at the example lines and forgets about the following paragraph that addresses this exact problem:

You need to set up an encrypted data bag item to secure the oracle user's password. See Opscode's docs site for details on encrypted data bags: encrypted data bag doc Your encrypted item requires a key named pw, whose value is the password of the oracle user- you can set that to whatever you want. You must set the value of node[:oracle][:user][:edb] to the name of your data bag, and that of node[:oracle][:user][:edb_item] to the name of the encrypted item; the defaults are oracle and foo, respectively.

llrosa commented 7 years ago

Good reference for creating your data bag here: https://cookingclouds.com/2012/06/23/chef-encrypted-data-bags-example/