evertrue / zookeeper-cookbook

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

link logic for ZK not working. #183

Closed Stromweld closed 8 years ago

Stromweld commented 8 years ago

After updating to the latest ZK cook book I've been getting this error below about the link not being able to be created due to folder existing. Even after trying to delete the folders and running chef client again I get the same error. It looks to be that some logic is creating a /opt/zookeeper/data directory with recursive true before ark installs and links the installed zk-version folder to /opt/zookeeper.

Recipe: zookeeper::install
  * zookeeper[3.4.8] action install
  Recipe: java::notify
    * log[jdk-version-changed] action nothing (skipped due to action :nothing)
  Recipe: java::set_java_home
    * ruby_block[set-env-java-home] action run (skipped due to not_if)
    * directory[/etc/profile.d] action create (up to date)
    * template[/etc/profile.d/jdk.sh] action create (up to date)
  Recipe: java::oracle
    * yum_package[tar] action install (up to date)
    * java_ark[jdk] action install (up to date)
    * java_alternatives[set-java-alternatives] action set (up to date)
    * chef_gem[zookeeper] action install (up to date)
    * group[zookeeper] action create (up to date)
    * user[zookeeper] action create (up to date)
    * directory[/opt] action create (up to date)
    * directory[/var/log/zookeeper] action create (up to date)
    * directory[/opt/zookeeper/data] action create
      - create new directory /opt/zookeeper/data
      - change mode from '' to '0700'
      - change owner from '' to 'zookeeper'
      - change group from '' to 'zookeeper'
      - restore selinux security context
    * ark[zookeeper] action install
      * directory[/opt/zookeeper-3.4.8] action create
        - create new directory /opt/zookeeper-3.4.8
        - restore selinux security context
      * remote_file[/var/chef/cache/zookeeper-3.4.8.tar.gz] action create (up to date)
      * execute[unpack /var/chef/cache/zookeeper-3.4.8.tar.gz] action nothing (skipped due to action :nothing)
      * execute[set owner on /opt/zookeeper-3.4.8] action nothing (skipped due to action :nothing)
      * link[/opt/zookeeper] action create

        ================================================================================
        Error executing action `create` on resource 'link[/opt/zookeeper]'
        ================================================================================

        Errno::EISDIR
        -------------
        Is a directory @ unlink_internal - /opt/zookeeper

        Cookbook Trace:
        ---------------
        /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:41:in `run_action'
        /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:41:in `run_action'
        /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:41:in `run_action'

        Resource Declaration:
        ---------------------
        # In /var/chef/cache/cookbooks/ark/providers/default.rb

         75:     link new_resource.home_dir do
         76:       to new_resource.path
         77:     end
         78:

        Compiled Resource:
        ------------------
        # Declared in /var/chef/cache/cookbooks/ark/providers/default.rb:75:in `block in class_from_file'

        link("/opt/zookeeper") do
          action [:create]
          retries 0
          retry_delay 2
          default_guard_interpreter :default
          to "/opt/zookeeper-3.4.8"
          link_type :symbolic
          target_file "/opt/zookeeper"
          declared_type :link
          cookbook_name "zookeeper"
        end

        Platform:
        ---------
        x86_64-linux

      * execute[unpack /var/chef/cache/zookeeper-3.4.8.tar.gz] action run
        - execute /bin/tar xzf /var/chef/cache/zookeeper-3.4.8.tar.gz --strip-components=1
      * execute[set owner on /opt/zookeeper-3.4.8] action run
        - execute chown -R root:0 /opt/zookeeper-3.4.8

      ================================================================================
      Error executing action `install` on resource 'ark[zookeeper]'
      ================================================================================

      Errno::EISDIR
      -------------
      link[/opt/zookeeper] (/var/chef/cache/cookbooks/ark/providers/default.rb line 75) had an error: Errno::EISDIR: Is a directory @ unlink_internal - /opt/zookeeper

      Cookbook Trace:
      ---------------
      /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:41:in `run_action'
      /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:41:in `run_action'
      /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:41:in `run_action'

      Resource Declaration:
      ---------------------
      # In /var/chef/cache/cookbooks/zookeeper/resources/default.rb

       83:   ark 'zookeeper' do
       84:     url         "#{mirror}/zookeeper-#{new_resource.version}/zookeeper-#{new_resource.version}.tar.gz"
       85:     version     new_resource.version
       86:     prefix_root install_dir
       87:     prefix_home install_dir
       88:     checksum    new_resource.checksum if property_is_set? :checksum
       89:   end
       90: end

      Compiled Resource:
      ------------------
      # Declared in /var/chef/cache/cookbooks/zookeeper/resources/default.rb:83:in `block in class_from_file'

      ark("zookeeper") do
        action [:install]
        updated true
        updated_by_last_action true
        retries 0
        retry_delay 2
        default_guard_interpreter :default
        declared_type :ark
        cookbook_name "zookeeper"
        url "http://apache.mirrors.tds.net/zookeeper//zookeeper-3.4.8/zookeeper-3.4.8.tar.gz"
        version "3.4.8"
        prefix_root "/opt"
        prefix_home "/opt"
        extension "tar.gz"
        prefix_bin "/usr/local/bin"
        home_dir "/opt/zookeeper"
        path "/opt/zookeeper-3.4.8"
        release_file "/var/chef/cache/zookeeper-3.4.8.tar.gz"
        owner "root"
      end

      Platform:
      ---------
      x86_64-linux

    ================================================================================
    Error executing action `install` on resource 'zookeeper[3.4.8]'
    ================================================================================

    Errno::EISDIR
    -------------
    ark[zookeeper] (/var/chef/cache/cookbooks/zookeeper/resources/default.rb line 83) had an error: Errno::EISDIR: link[/opt/zookeeper] (/var/chef/cache/cookbooks/ark/providers/default.rb line 75) had an error: Errno::EISDIR: Is a directory @ unlink_internal - /opt/zookeeper

    Cookbook Trace:
    ---------------
    /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:41:in `run_action'
    /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:41:in `run_action'
    /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:41:in `run_action'

    Resource Declaration:
    ---------------------
    # In /var/chef/cache/cookbooks/zookeeper/recipes/install.rb

     18: zookeeper node['zookeeper']['version'] do
     19:   username          node['zookeeper']['user']
     20:   user_home         node['zookeeper']['user_home']
     21:   mirror            node['zookeeper']['mirror']
     22:   checksum          node['zookeeper']['checksum']
     23:   install_dir       node['zookeeper']['install_dir']
     24:   log_dir           node['zookeeper']['log_dir']
     25:   data_dir          node['zookeeper']['config']['dataDir']
     26:   use_java_cookbook node['zookeeper']['use_java_cookbook']
     27: end

    Compiled Resource:
    ------------------
    # Declared in /var/chef/cache/cookbooks/zookeeper/recipes/install.rb:18:in `from_file'

    zookeeper("3.4.8") do
      action [:install]
      updated true
      updated_by_last_action true
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      declared_type :zookeeper
      cookbook_name "zookeeper"
      recipe_name "install"
      username "zookeeper"
      user_home "/opt/zookeeper/home"
      mirror "http://apache.mirrors.tds.net/zookeeper/"
      checksum "f10a0b51f45c4f64c1fe69ef713abf9eb9571bc7385a82da892e83bb6c965e90"
      install_dir "/opt"
      log_dir "/var/log/zookeeper"
      data_dir "/opt/zookeeper/data"
      use_java_cookbook true
      version "3.4.8"
    end

    Platform:
    ---------
    x86_64-linux

Running handlers:
[2016-07-25T11:23:34-05:00] ERROR: Running exception handlers
  - Motd::KnifeStatus
Running handlers complete
[2016-07-25T11:23:34-05:00] ERROR: Exception handlers complete
Chef Client failed. 15 resources updated in 24 seconds
[2016-07-25T11:23:34-05:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2016-07-25T11:23:34-05:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-07-25T11:23:34-05:00] ERROR: zookeeper[3.4.8] (zookeeper::install line 18) had an error: Errno::EISDIR: ark[zookeeper] (/var/chef/cache/cookbooks/zookeeper/resources/default.rb line 83) had an error: Errno::EISDIR: link[/opt/zookeeper] (/var/chef/cache/cookbooks/ark/providers/default.rb line 75) had an error: Errno::EISDIR: Is a directory @ unlink_internal - /opt/zookeeper
[2016-07-25T11:23:34-05:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

[root@paw2cl-zookpr03 opt]# ls -alh /opt
total 32K
drwxr-xr-x.  8 root root 4.0K Jul 25 11:23 .
dr-xr-xr-x. 28 root root 4.0K Jul 19 04:49 ..
drwxr-xr-x.  6 root root 4.0K Jul 18 14:45 chef
drwxr-xr-x. 10 root root 4.0K Mar 23 15:04 collectd
drwxr-xr-x.  4 root root 4.0K Nov 13  2015 opscode-push-jobs-client
drwxr-xr-x.  2 root root 4.0K Mar 26  2015 rh
drwxr-xr-x.  3 root root 4.0K Jul 25 11:23 zookeeper
drwxr-xr-x. 10 root root 4.0K Jul 25 11:23 zookeeper-3.4.8
[root@paw2cl-zookpr03 opt]# ls -alh /opt/zookeeper
total 12K
drwxr-xr-x. 3 root      root      4.0K Jul 25 11:23 .
drwxr-xr-x. 8 root      root      4.0K Jul 25 11:23 ..
drwx------. 2 zookeeper zookeeper 4.0K Jul 25 11:23 data
[root@paw2cl-zookpr03 opt]# ls -alh /opt/zookeeper/data/
total 8.0K
drwx------. 2 zookeeper zookeeper 4.0K Jul 25 11:23 .
drwxr-xr-x. 3 root      root      4.0K Jul 25 11:23 ..
Stromweld commented 8 years ago

This is on CentOS 6.8 with chef-client 12.12.15