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
{{ message }}
This repository has been archived by the owner on Sep 19, 2020. It is now read-only.
[birdsnest ~/local/data/sis/git/cookbooks/cub_jenkins](polishing|✚1)[I]% foodcritic .
Checking 12 files
.......x....
FC022: Resource condition within loop may not behave as expected: ./recipes/master.rb:17
And here is recipes/master.rb up to the resource defined on line 17 (ruby_block[trigger jenkins ...]):
include_recipe 'cub_java'
include_recipe 'jenkins::master'
include_recipe 'cub_jenkins::proxy'
node['cub_jenkins']['plugins'].each do |name, ver|
jenkins_plugin name do
version ver
# don't do dependency resolution on plugins. see attributes/master.rb and
# https://github.com/chef-cookbooks/jenkins/issues/534
install_deps false
end
end
# restart jenkins now if any of above plugins have been updated.
# keypair credentials below depends on plugins being loaded
# which won't happen until jenkins is restarted.
ruby_block 'trigger jenkins restart to enable plugins' do
block {}
notifies :restart, 'service[jenkins]', :immediately
only_if do
node['cub_jenkins']['plugins'].map do |name, _version|
resources("jenkins_plugin[#{name}]").updated_by_last_action?
end.any?
end
end
Foodcritic is complaining that the ruby_block resource is defined with a fixed name in a loop, but it's not defined in a loop. The previously defined resources are in a loop, which seems to trigger the issue. if I comment out either the node['cub_jenkins']['plugins'].each loop or the ruby_block resource, then foodcritic stops complaining.
And here is
recipes/master.rb
up to the resource defined on line 17 (ruby_block[trigger jenkins ...]
):Foodcritic is complaining that the
ruby_block
resource is defined with a fixed name in a loop, but it's not defined in a loop. The previously defined resources are in a loop, which seems to trigger the issue. if I comment out either thenode['cub_jenkins']['plugins'].each
loop or theruby_block
resource, then foodcritic stops complaining.The text was updated successfully, but these errors were encountered: