rabbitmq / chef-cookbook

Development repository for Chef cookbook RabbitMQ
https://supermarket.chef.io/cookbooks/rabbitmq
Apache License 2.0
214 stars 423 forks source link

Plugin installation breaks on Chef >= 16 #563

Closed dud225 closed 4 years ago

dud225 commented 4 years ago

Hello

Running the management_ui recipe on Chef 16 fails:

Recipe: rabbitmq::management_ui
  * rabbitmq_plugin[rabbitmq_management] action enable
    * execute[rabbitmq-plugins enable rabbitmq_management] action run

      ================================================================================
      Error executing action `run` on resource 'execute[rabbitmq-plugins enable rabbitmq_management]'
      ================================================================================

      TypeError
      ---------
      no implicit conversion from nil to integer

      Resource Declaration:
      ---------------------
      # In /opt/kitchen/cache/cookbooks/rabbitmq/providers/plugin.rb

       43:     execute "rabbitmq-plugins enable #{new_resource.plugin}" do
       44:       umask 0022
       45:       Chef::Log.info "Enabling RabbitMQ plugin '#{new_resource.plugin}'."
       46:       environment shell_environment.merge(
       47:         'PATH' => "#{ENV['PATH']}:/usr/lib/rabbitmq/bin"
       48:       )
       49:       new_resource.updated_by_last_action(true)
       50:     end
       51:   end

      Compiled Resource:
      ------------------
      # Declared in /opt/kitchen/cache/cookbooks/rabbitmq/providers/plugin.rb:43:in `block in class_from_file'

      execute("rabbitmq-plugins enable rabbitmq_management") do
        action [:run]
        default_guard_interpreter :execute
        command "rabbitmq-plugins enable rabbitmq_management"
        backup 5
        declared_type :execute
        cookbook_name "rabbitmq"
        domain nil
        user nil
        environment {"HOME"=>"/root", "PATH"=>"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/rabbitmq/bin:/usr/lib/rabbitmq/bin"}
        umask 18
      end

      System Info:
      ------------
      chef_version=16.2.73
      platform=ubuntu
      platform_version=16.04
      ruby=ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
      program_name=/opt/chef/bin/chef-client
      executable=/opt/chef/bin/chef-client

    ================================================================================
    Error executing action `enable` on resource 'rabbitmq_plugin[rabbitmq_management]'
    ================================================================================

    TypeError
    ---------
    execute[rabbitmq-plugins enable rabbitmq_management] (/opt/kitchen/cache/cookbooks/rabbitmq/providers/plugin.rb line 43) had an error: TypeError: no implicit conversion from nil to integer

    Resource Declaration:
    ---------------------
    # In /opt/kitchen/cache/cookbooks/rabbitmq/recipes/management_ui.rb

     30:   rabbitmq_plugin plugin do
     31:     action :enable
     32:     notifies :restart, "service[#{service_name}]", :immediately
     33:   end
     34: end

    Compiled Resource:
    ------------------
    # Declared in /opt/kitchen/cache/cookbooks/rabbitmq/recipes/management_ui.rb:30:in `block in from_file'

    rabbitmq_plugin("rabbitmq_management") do
      action [:enable]
      updated true
      updated_by_last_action true
      default_guard_interpreter :default
      declared_type :rabbitmq_plugin
      cookbook_name "rabbitmq"
      recipe_name "management_ui"
    end

    System Info:
    ------------
    chef_version=16.2.73
    platform=ubuntu
    platform_version=16.04
    ruby=ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
    program_name=/opt/chef/bin/chef-client
    executable=/opt/chef/bin/chef-client

It works fine on Chef 15 though.

I'm wondering if it's not the Chef::Log.info "Enabling RabbitMQ plugin '#{new_resource.plugin}'." statement in the middle that wreaks havoc.

Regards

michaelklishin commented 4 years ago

Duplicate of #561.

michaelklishin commented 4 years ago

I would appreciate if you tried the tip of v5.x before we cut a new release.

dud225 commented 4 years ago

Sorry I didn't look for any existing issue before creating a new one. I can confirm that the v5.x branch featuring v 5.8.5 fixes the issue.

michaelklishin commented 4 years ago

Thank you. A new release will be out tomorrow if all goes well.