Failing sc-mongodb cookbook


#1

Hi,

I am trying to setup mongodb with sc-mongodb cookbook on Redhat 7. I am using chef client version 12.18.31. Following is my recipe

include_recipe “sc-mongodb::default”

data_dir = "#{node[‘application’][‘dbPath’]}"
directory data_dir do
recursive true
owner 'mongod’
group 'mongod’
mode '0755’
not_if { ::File.exist?(data_dir) }
end
mongodb_instance “mongodb” do
port node[‘application’][‘port’]
dbpath node[‘application’][‘dbPath’]
bindIp node[‘application’][‘bindIp’]
end

When I run the cookbook, I get following error:

10.248.28.125 Recipe: cp_mongodb::default
10.248.28.125   * service[mongodb] action restart[2018-02-08T16:37:27-05:00] ERROR: service[mongodb] (cp_mongodb::default line 222) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
10.248.28.125 ---- Begin output of /sbin/service mongodb restart ----
10.248.28.125 STDOUT: Restarting mongodb (via systemctl):  [FAILED]
10.248.28.125 STDERR: Job for mongodb.service failed because the control process exited with error code. See "systemctl status mongodb.service" and "journalctl -xe" for details.
10.248.28.125 ---- End output of /sbin/service mongodb restart ----
10.248.28.125 Ran /sbin/service mongodb restart returned 1; ignore_failure is set, continuing
10.248.28.125 
10.248.28.125     
10.248.28.125     ================================================================================
10.248.28.125     Error executing action `restart` on resource 'service[mongodb]'
10.248.28.125     ================================================================================
10.248.28.125     
10.248.28.125     Mixlib::ShellOut::ShellCommandFailed
10.248.28.125     ------------------------------------
10.248.28.125     Expected process to exit with [0], but received '1'
10.248.28.125     ---- Begin output of /sbin/service mongodb restart ----
10.248.28.125     STDOUT: Restarting mongodb (via systemctl):  [FAILED]
10.248.28.125     STDERR: Job for mongodb.service failed because the control process exited with error code. See "systemctl status mongodb.service" and "journalctl -xe" for details.
10.248.28.125     ---- End output of /sbin/service mongodb restart ----
10.248.28.125     Ran /sbin/service mongodb restart returned 1
10.248.28.125     
10.248.28.125     Resource Declaration:
10.248.28.125     ---------------------
10.248.28.125     # In /var/chef/cache/cookbooks/sc-mongodb/definitions/mongodb.rb
10.248.28.125     
10.248.28.125     222:   service new_resource.name do
10.248.28.125     223:     supports status: true, restart: true
10.248.28.125     224:     action new_resource.service_action
10.248.28.125     225:     new_resource.service_notifies.each do |service_notify|
10.248.28.125     226:       notifies :run, service_notify
10.248.28.125     227:     end
10.248.28.125     228:     notifies :run, 'ruby_block[config_replicaset]', :immediately if new_resource.is_replicaset && new_resource.auto_configure_replicaset
10.248.28.125     229:     notifies :run, 'ruby_block[config_sharding]', :immediately if new_resource.is_mongos && new_resource.auto_configure_sharding
10.248.28.125     230:     # we don't care about a running mongodb service in these cases, all we need is stopping it
10.248.28.125     231:     ignore_failure true if new_resource.name == 'mongodb'
10.248.28.125     232:   end
10.248.28.125     233: 
10.248.28.125     234:   # replicaset
10.248.28.125     235:   if new_resource.is_replicaset && new_resource.auto_configure_replicaset
10.248.28.125     236:     rs_nodes = search(
10.248.28.125     237:       :node,
10.248.28.125     238:       "mongodb_cluster_name:#{new_resource.cluster_name} AND "\
10.248.28.125     239:       'mongodb_is_replicaset:true AND '\
10.248.28.125     240:       "mongodb_config_mongod_replication_replSetName:#{new_resource.replicaset_name} AND "\
10.248.28.125     241:       "chef_environment:#{node.chef_environment}"
10.248.28.125     242:     )
10.248.28.125     243: 
10.248.28.125     244:     ruby_block 'config_replicaset' do
10.248.28.125     245:       block do
10.248.28.125     246:         MongoDB.configure_replicaset(node, replicaset_name, rs_nodes) unless new_resource.replicaset.nil?
10.248.28.125     247:       end
10.248.28.125     248:       action :nothing
10.248.28.125     249:     end
10.248.28.125     250: 
10.248.28.125     251:     ruby_block 'run_config_replicaset' do
10.248.28.125     252:       block {}
10.248.28.125     253:       notifies :run, 'ruby_block[config_replicaset]'
10.248.28.125     254:     end
10.248.28.125     255:   end
10.248.28.125     256: 
10.248.28.125     
10.248.28.125     Compiled Resource:
10.248.28.125     ------------------
10.248.28.125     # Declared in /var/chef/cache/cookbooks/sc-mongodb/definitions/mongodb.rb:222:in `block in from_file'
10.248.28.125     
10.248.28.125     service("mongodb") do
10.248.28.125       params {:mongodb_type=>"mongod", :action=>[:enable, :start], :logpath=>"/var/log/mongodb/mongod.log", :configservers=>[], :replicaset=>nil, :notifies=>[], :port=>"27017", :dbpath=>"/usr/local/paxata/mongo", :bindIp=>"0.0.0.0", :name=>"mongodb"}
10.248.28.125       action [:enable, :start]
10.248.28.125       updated true
10.248.28.125       supports {:status=>true, :restart=>true}
10.248.28.125       ignore_failure true
10.248.28.125       retries 0
10.248.28.125       retry_delay 2
10.248.28.125       default_guard_interpreter :default
10.248.28.125       service_name "mongodb"
10.248.28.125       enabled true
10.248.28.125       pattern "mongodb"
10.248.28.125       declared_type :service
10.248.28.125       cookbook_name "cp_mongodb"
10.248.28.125       recipe_name "default"
10.248.28.125     end
10.248.28.125     
10.248.28.125     Platform:
10.248.28.125     ---------
10.248.28.125     x86_64-linux
10.248.28.125     
10.248.28.125 
10.248.28.125 Running handlers:
10.248.28.125 Running handlers complete
10.248.28.125 
10.248.28.125 Deprecated features used!
10.248.28.125   Cloning resource attributes for template[/etc/sysconfig/mongodb] from prior resource
10.248.28.125 Previous template[/etc/sysconfig/mongodb]: /var/chef/cache/cookbooks/sc-mongodb/definitions/mongodb.rb:146:in `block in from_file'
10.248.28.125 Current  template[/etc/sysconfig/mongodb]: /var/chef/cache/cookbooks/sc-mongodb/definitions/mongodb.rb:146:in `block in from_file' at 1 location:
10.248.28.125     - /var/chef/cache/cookbooks/sc-mongodb/definitions/mongodb.rb:146:in `block in from_file'
10.248.28.125    See https://docs.chef.io/deprecations_resource_cloning.html for further details.
10.248.28.125   Cloning resource attributes for template[/etc/mongod.conf] from prior resource
10.248.28.125 Previous template[/etc/mongod.conf]: /var/chef/cache/cookbooks/sc-mongodb/definitions/mongodb.rb:159:in `block in from_file'
10.248.28.125 Current  template[/etc/mongod.conf]: /var/chef/cache/cookbooks/sc-mongodb/definitions/mongodb.rb:159:in `block in from_file' at 1 location:
10.248.28.125     - /var/chef/cache/cookbooks/sc-mongodb/definitions/mongodb.rb:159:in `block in from_file'
10.248.28.125    See https://docs.chef.io/deprecations_resource_cloning.html for further details.
10.248.28.125   Cloning resource attributes for directory[/var/log/mongodb] from prior resource
10.248.28.125 Previous directory[/var/log/mongodb]: /var/chef/cache/cookbooks/sc-mongodb/definitions/mongodb.rb:173:in `block in from_file'
10.248.28.125 Current  directory[/var/log/mongodb]: /var/chef/cache/cookbooks/sc-mongodb/definitions/mongodb.rb:173:in `block in from_file' at 1 location:
10.248.28.125     - /var/chef/cache/cookbooks/sc-mongodb/definitions/mongodb.rb:173:in `block in from_file'
10.248.28.125    See https://docs.chef.io/deprecations_resource_cloning.html for further details.
10.248.28.125   Cloning resource attributes for directory[/var/lib/mongo] from prior resource
10.248.28.125 Previous directory[/var/lib/mongo]: /var/chef/cache/cookbooks/sc-mongodb/definitions/mongodb.rb:184:in `block in from_file'
10.248.28.125 Current  directory[/var/lib/mongo]: /var/chef/cache/cookbooks/sc-mongodb/definitions/mongodb.rb:184:in `block in from_file' at 1 location:
10.248.28.125     - /var/chef/cache/cookbooks/sc-mongodb/definitions/mongodb.rb:184:in `block in from_file'
10.248.28.125    See https://docs.chef.io/deprecations_resource_cloning.html for further details.
10.248.28.125 
10.248.28.125 Chef Client finished, 21/35 resources updated in 04 minutes 03 seconds