From 9c061c07df6a1eb350c6cebf5c5039f1c354eb25 Mon Sep 17 00:00:00 2001 From: Lance Albertson Date: Thu, 16 Jul 2020 23:14:17 -0700 Subject: [PATCH] Fix Chef 16 issue with plugin resource It appears that ruby-2.7 (which ships with Chef 16) likely doesn't like ``0022`` as an integer and is causing issues on Chef 16. To workaround the issue, we can simply change this to a string. The following is the output of the original error I've been hitting. ``` 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 /tmp/kitchen/cache/cookbooks/rabbitmq/providers/plugin.rb 37: execute "rabbitmq-plugins enable #{new_resource.plugin}" do 38: umask 0022 39: Chef::Log.info "Enabling RabbitMQ plugin '#{new_resource.plugin}'." 40: environment shell_environment.merge( 41: 'PATH' => "#{ENV['PATH']}:/usr/lib/rabbitmq/bin" 42: ) 43: new_resource.updated_by_last_action(true) 44: end 45: end ``` Signed-off-by: Lance Albertson --- providers/plugin.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/providers/plugin.rb b/providers/plugin.rb index b8ab15bc..b5d82f2a 100644 --- a/providers/plugin.rb +++ b/providers/plugin.rb @@ -39,7 +39,7 @@ def plugin_enabled?(name) action :enable do unless plugin_enabled?(new_resource.plugin) execute "rabbitmq-plugins enable #{new_resource.plugin}" do - umask 0022 + umask '0022' Chef::Log.info "Enabling RabbitMQ plugin '#{new_resource.plugin}'." environment shell_environment.merge( 'PATH' => "#{ENV['PATH']}:/usr/lib/rabbitmq/bin" @@ -52,7 +52,7 @@ def plugin_enabled?(name) action :disable do if plugin_enabled?(new_resource.plugin) execute "rabbitmq-plugins disable #{new_resource.plugin}" do - umask 0022 + umask '0022' Chef::Log.info "Disabling RabbitMQ plugin '#{new_resource.plugin}'." environment shell_environment.merge( 'PATH' => "#{ENV['PATH']}:/usr/lib/rabbitmq/bin"