jenkins
jenkins copied to clipboard
jenkins_plugin emits unhelpful error message when plugin does not exist
It took me a little while to figure out that the following occurs when the plugin being installed does not exist. At first, I inferred from this error message that there was a bug in jenkins_plugin, not that the plugin does not exist.
Recipe: cub_jenkins::master
* jenkins_plugin[foobar] action install
Recipe: <Dynamically Defined Resource>
* remote_file[/tmp/kitchen/cache/update-center.json] action create (up to date)
* file[/tmp/kitchen/cache/extracted-update-center.json] action create (up to date)
================================================================================
Error executing action `install` on resource 'jenkins_plugin[foobar]'
================================================================================
NoMethodError
-------------
undefined method `[]' for nil:NilClass
Cookbook Trace:
---------------
/tmp/kitchen/cache/cookbooks/jenkins/libraries/plugin.rb:267:in `install_plugin_from_update_center'
/tmp/kitchen/cache/cookbooks/jenkins/libraries/plugin.rb:124:in `block (2 levels) in <class:JenkinsPlugin>'
/tmp/kitchen/cache/cookbooks/jenkins/libraries/plugin.rb:154:in `block in <class:JenkinsPlugin>'
Resource Declaration:
---------------------
# In /tmp/kitchen/cache/cookbooks/cub_jenkins/recipes/master.rb
5: node['cub_jenkins']['plugins'].each { |p| jenkins_plugin p }
6:
Compiled Resource:
------------------
# Declared in /tmp/kitchen/cache/cookbooks/cub_jenkins/recipes/master.rb:5:in `block in from_file'
jenkins_plugin("foobar") do
action [:install]
retries 0
retry_delay 2
default_guard_interpreter :default
declared_type :jenkins_plugin
cookbook_name "cub_jenkins"
recipe_name "master"
end
Platform:
---------
x86_64-linux
We discussed this last week in our issue triage. We know about it, and when we rewrite this resource will resolve this issue. With ChefConf coming up shortly, this will be completed most likely post-ChefConf.
Thanks for reporting.