evertrue / zookeeper-cookbook

Chef cookbook for installing and managing Zookeeper.
https://supermarket.chef.io/cookbooks/zookeeper
Apache License 2.0
81 stars 119 forks source link

zookeeper user needs a home folder #163

Closed jeffbyrnes closed 8 years ago

jeffbyrnes commented 8 years ago

As pointed out by @bwhaley in #142:

@petere pointed out that home dirs are not created, and for me this caused errors in the log like this:

2016-02-20_00:19:38.01251 Feb 20, 2016 12:19:38 AM java.util.prefs.FileSystemPreferences > checkLockFile0ErrorCode
2016-02-20_00:19:38.01254 WARNING: Could not lock User prefs.  Unix error code 2.
2016-02-20_00:19:38.01254 Feb 20, 2016 12:19:38 AM java.util.prefs.FileSystemPreferences syncWorld
2016-02-20_00:19:38.01255 WARNING: Couldn't flush user prefs: java.util.prefs.BackingStoreException: Couldn't get file lock.

I work around this in my wrapper cookbook

directory "/home/#{node['exhibitor']['user']}" do
    action :create
    owner node['exhibitor']['user']
    group node['exhibitor']['user']
    mode '0700'
end

But maybe it should be done when the user is created?

bwhaley commented 8 years ago

Great, thanks!

popsikle commented 8 years ago

I think you missed the resources in that patch.

  ================================================================================
  Recipe Compile Error in /var/chef/cache/cookbooks/role_mesos/recipes/master.rb
  ================================================================================

  NoMethodError
  -------------
  undefined method `user_home' for LWRP resource zookeeper from cookbook zookeeper

  Cookbook Trace:
  ---------------
    /var/chef/cache/cookbooks/zookeeper/recipes/install.rb:31:in `block in from_file'
    /var/chef/cache/cookbooks/zookeeper/recipes/install.rb:29:in `from_file'
    /var/chef/cache/cookbooks/exhibitor/recipes/default.rb:26:in `from_file'
    /var/chef/cache/cookbooks/role_mesos/recipes/master.rb:9:in `from_file'

  Relevant File Content:
  ----------------------
  /var/chef/cache/cookbooks/zookeeper/recipes/install.rb:

   24:
   25:  # build-essential is required to build the zookeeper and json gems
   26:  node.override['build-essential']['compile_time'] = true
   27:  include_recipe 'build-essential::default'
   28:
   29:  zookeeper node[:zookeeper][:version] do
   30:    user        node[:zookeeper][:user]
   31>>   user_home   node[:zookeeper][:user_home]
   32:    mirror      node[:zookeeper][:mirror]
   33:    checksum    node[:zookeeper][:checksum]
   34:    install_dir node[:zookeeper][:install_dir]
   35:    log_dir     node[:zookeeper][:log_dir]
   36:    data_dir    node[:zookeeper][:config][:dataDir]
   37:    action      :install
   38:  end
   39:
   40:  # Add optional Zookeeper environment vars