You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The exception is caused by gsub!(/'/, '') returning nil if no quotes are found in the match variable.
Based on the chef-shell output, I believe this line:
result=match && match.gsub!(/'/,'').split(',')
with:
result=match && match.gsub(/'/,'')
chef-shell output:
chef(12.4.1)> pattern='({running_nodes,\[\'*)(.*?)(\'*\]})'=>"({running_nodes,\\['*)(.*?)('*\\]})"chef(12.4.1)> match=match_pattern_cluster_status(cluster_status,pattern)=>"rabbit@host-1.example.com"chef(12.4.1)> result=match && match.gsub!(/'/,'').split(',')NoMethodError: undefinedmethod`split' for nil:NilClass from (irb):40 from /opt/chef/embedded/apps/chef/lib/chef/shell.rb:76:in `blockinstart' from /opt/chef/embedded/apps/chef/lib/chef/shell.rb:75:in `catch'from/opt/chef/embedded/apps/chef/lib/chef/shell.rb:75:in`start' from /opt/chef/embedded/apps/chef/bin/chef-shell:37:in `<top(required)>' from /usr/bin/chef-shell:55:in `load'from/usr/bin/chef-shell:55:in `<main>'
chef (12.4.1)> match = match_pattern_cluster_status(cluster_status, pattern)
=> "rabbit@host-1.example.com"
chef (12.4.1)> result = match && match.gsub!(/'/, '')
=> nil
chef (12.4.1)> match = match_pattern_cluster_status(cluster_status, pattern)
=> "rabbit@host-1.example.com"
chef (12.4.1)> result = match && match.gsub(/'/, '')
=> "rabbit@host-1.example.com"
chef (12.4.1)> Chef::Log.debug("[rabbitmq_cluster] running_nodes : #{result}") => [#<Logger:0x000000056fc840 @progname=nil, @level=2, @default_formatter=#<Logger::Formatter:0x000000056fc7c8 @datetime_format=nil>, @formatter=#<Mixlib::Log::Formatter:0x000000056fc638 @datetime_format=nil>, @logdev=#<Logger::LogDevice:0x000000056fc728 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x000000056fc700 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x000000056fc660>>>>] chef (12.4.1)> !result.nil? ? result.split(',') : [] => ["rabbit@host-1.example.com"]
PR in progress...
The text was updated successfully, but these errors were encountered:
I suspect a bug in the
running_nodes
method since #274.If
cluster_status
returns only one running node,running_nodes
throws this exception:My test node runlist:
My masked attributes:
The exception is caused by
gsub!(/'/, '')
returning nil if no quotes are found in thematch
variable.Based on the
chef-shell
output, I believe this line:with:
chef-shell
output:PR in progress...
The text was updated successfully, but these errors were encountered: