[chef] NoMethodError


Chronological Thread 
  • From: niristotle okram < >
  • To:
  • Subject: [chef] NoMethodError
  • Date: Fri, 12 Jun 2015 13:53:20 -0700


Hi there, 
 
  my kitchen test is failing while installing a jenkins plugin, parameterized-trigger. this is the block that calls the plugins: I am using the community jenkins cookbook


unless node['jenkins']['plugins'].nil?
  node['jenkins']['plugins'].each do |plugin, version|
    case version
      when 'latest'
        jenkins_plugin plugin do
          notifies :restart, "service[jenkins]", :delayed
        end
      else
        jenkins_plugin plugin do
          version version
          notifies :restart, "service[jenkins]", :delayed
        end
    end
  end
end



And the plugins are defined as below in the attributes


default['jenkins']['plugins'] = {
  'ant' => 'latest',
  'collabnet' => 'latest',
  'credentials' => 'latest',
  'cvs' => 'latest',
  'deploy' => '1.9',
  'external-monitor-job' => 'latest',
  'git-client' => '1.10.1',
  'git' => '2.2.5',
  'greenballs' => 'latest',
  'javadoc' => 'latest',
  'ldap' => 'latest',
  'mailer' => 'latest',
  'mapdb-api' => 'latest',
  'matrix-auth' => 'latest',
  'matrix-project' => 'latest',
  'maven-plugin' => '2.6',
  'm2release' => 'latest',
  'antisamy-markup-formatter' => 'latest',
  'pam-auth' => 'latest',
  'parameterized-trigger' => 'latest',
  'promoted-builds' => 'latest',
  'ruby-runtime' => 'latest',
  'scm-api' => 'latest',
  'ssh-agent' => 'latest',
  'ssh-credentials' => 'latest',
  'ssh-slaves' => 'latest',
  'subversion' => 'latest',
  'translation' => 'latest',
  'windows-slaves' => 'latest'
}


Below is the chef log from the console. 



  * jenkins_plugin[parameterized-trigger] action install       [2015-06-12T21:42:06+01:00] INFO: Processing jenkins_plugin[parameterized-trigger] action install (my_jenkins::jenkins_master line 149)
       
           
       
           ================================================================================
    Error executing action `install` on resource 'jenkins_plugin[parameterized-trigger]'       
    ================================================================================       
           
    NoMethodError       
           -------------
    undefined method `[]' for nil:NilClass       
           
           Cookbook Trace:
           ---------------
           /tmp/kitchen/cookbooks/jenkins/libraries/plugin.rb:258:in `install_plugin_from_update_center'
           
/tmp/kitchen/cookbooks/jenkins/libraries/plugin.rb:124:in `block (2 levels) in <class:JenkinsPlugin>'       
           
       /tmp/kitchen/cookbooks/jenkins/libraries/plugin.rb:155:in `block in <class:JenkinsPlugin>'
           
       
           Resource Declaration:
    ---------------------       
           # In /tmp/kitchen/cookbooks/my_jenkins/recipes/jenkins_master.rb
           
       
       
    149:         jenkins_plugin plugin do       
           
       150:           notifies :restart, "service[jenkins]", :delayed
           151:         end
           152:       else
       
           
       
    Compiled Resource:       
           ------------------
           # Declared in /tmp/kitchen/cookbooks/my_jenkins/recipes/jenkins_master.rb:149:in `block in from_file'
       
           
           jenkins_plugin("parameterized-trigger") do
             action :install
       
             retries 0
       
             retry_delay 2
       
             guard_interpreter :default
       
             cookbook_name :"my_jenkins"
       
             recipe_name "jenkins_master"
       
             version :latest
       
             install_deps true
       
           end
       
           
       
       [2015-06-12T21:42:06+01:00] INFO: Running queued delayed notifications before re-raising exception
       [2015-06-12T21:42:06+01:00] INFO: jenkins_plugin[maven-plugin] sending restart action to service[jenkins] (delayed)
  * service[jenkins] action restart       [2015-06-12T21:42:06+01:00] INFO: Processing service[jenkins] action restart (my_jenkins::jenkins_master line 309)
       [2015-06-12T21:42:07+01:00] INFO: service[jenkins] restarted
       
    - restart service service[jenkins]       
       
       
       Running handlers:
       [2015-06-12T21:42:07+01:00] ERROR: Running exception handlers
       Running handlers complete
       [2015-06-12T21:42:07+01:00] ERROR: Exception handlers complete
       [2015-06-12T21:42:07+01:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
Chef Client failed. 15 resources updated in 88.662186983 seconds       
       [2015-06-12T21:42:07+01:00] ERROR: jenkins_plugin[parameterized-trigger] (my_jenkins::jenkins_master line 149) had an error: NoMethodError: undefined method `[]' for nil:NilClass
       [2015-06-12T21:42:07+01:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
>>>>>> Converge failed on instance <jenkins-master-centos>.
>>>>>> Please see .kitchen/logs/jenkins-master-centos.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [sudo -E chef-solo --config /tmp/kitchen/solo.rb --json-attributes /tmp/kitchen/dna.json  --log_level info]
>>>>>> ----------------------







Any idea, where this plugin alone is faulting?









Archive powered by MHonArc 2.6.16.

§