Chef-run failure for a custom recipe


#1

i have this recipe for jenkins and i am trying to use it on an aws node for
some test. i am using using chef-solo & knife-sole.

The point of failure is in this part of the recipe (the highlighted)

template “#{node[:jenkins][:master][:home]}/config.xml” do
source 'config.xml.erb’
variables(
master_executors: node[:jenkins][:master_config][:master_executors],
ldap: localLdap,
clouds: node[:jenkins][:master][:clouds] || nil,
views: node[:jenkins][:master][:views] || nil
)
notifies :restart, ‘service[jenkins]’, :immediately
end

ruby_block ‘set private key’ do

  • block { node.run_state[:jenkins_private_key] =
    data_bag[“jenkins_private_key”] }*
    end

As per the debug log, its pointing to a time-out somewhere. Is this
something, that i need to tweak on the AWS node? I have the SSH, HTTP,
HTTPS already listening on all inbounds and the 127.0.0.1 is listening on
8080.

netstat -ntlp
(No info could be read for “-p”: geteuid()=500 but you should be root.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address
State PID/Program name
tcp 0 0 0.0.0.0:51810 0.0.0.0:*
LISTEN -
tcp 0 0 0.0.0.0:111 0.0.0.0:*
LISTEN -
tcp 0 0 0.0.0.0:80 0.0.0.0:*
LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:*
LISTEN -
tcp 0 0 127.0.0.1:25 0.0.0.0:*
LISTEN -
tcp 0 0 :::55235 :::*
LISTEN -
tcp 0 0 :::54666 :::*
LISTEN -
tcp 0 0 :::111 :::*
LISTEN -
tcp 0 0 ::ffff:127.0.0.1:8080 http://127.0.0.1:8080
:::
LISTEN - *
tcp 0 0 :::38485 :::*
LISTEN -
tcp 0 0 :::22 :::*
LISTEN -

Below is a piece the debug log, & the extended log is here:
http://pastebin.com/fqNp9zkp

[2015-05-05T21:17:11-07:00] DEBUG: found target_uid == nil, so no owner was
specified on resource, not managing owner
[2015-05-05T21:17:11-07:00] DEBUG: found target_gid == nil, so no group was
specified on resource, not managing group
(up to date)
DEBUG: sudo -E -p 'knife sudo password: ’ chef-solo -c ~/chef-solo/solo.rb
-j ~/chef-solo/dna.json -l debug stdout:
DEBUG: sudo -E -p 'knife sudo password: ’ chef-solo -c
~/chef-solo/solo.rb -j ~/chef-solo/dna.json -l debug stdout:

================================================================================
Error executing action create on resource
’jenkins_private_key_credentials[user_build]’

================================================================================

Mixlib::ShellOut::CommandTimeout
--------------------------------
Command timed out after 60s:
Command exceeded allowed execution time, process terminated
---- Begin output of "/usr/lib/jvm/java/bin/java" -jar

“/var/chef/cache/jenkins-cli.jar” -s http://localhost:8080 -i
"/var/chef/cache/jenkins-key" groovy /tmp/groovy20150505-27740-1o9e28c ----
STDOUT:
STDERR:
---- End output of “/usr/lib/jvm/java/bin/java” -jar
"/var/chef/cache/jenkins-cli.jar" -s http://localhost:8080 -i
"/var/chef/cache/jenkins-key" groovy /tmp/groovy20150505-27740-1o9e28c ----
Ran “/usr/lib/jvm/java/bin/java” -jar “/var/chef/cache/jenkins-cli.jar”
-s http://localhost:8080 -i “/var/chef/cache/jenkins-key” groovy
/tmp/groovy20150505-27740-1o9e28c returned 143

Cookbook Trace:
---------------

/home/ec2-user/chef-solo/cookbooks-2/jenkins/libraries/_executor.rb:81:in
`execute!’

/home/ec2-user/chef-solo/cookbooks-2/jenkins/libraries/_executor.rb:127:in
`groovy!’

/home/ec2-user/chef-solo/cookbooks-2/jenkins/libraries/credentials.rb:205:in
`current_credentials’

/home/ec2-user/chef-solo/cookbooks-2/jenkins/libraries/credentials_private_key.rb:117:in
`current_credentials’

/home/ec2-user/chef-solo/cookbooks-2/jenkins/libraries/credentials.rb:79:in
`load_current_resource’

/home/ec2-user/chef-solo/cookbooks-2/jenkins/libraries/credentials_private_key.rb:69:in
`load_current_resource’

Resource Declaration:
---------------------
# In

/home/ec2-user/chef-solo/cookbooks-2/mytest_jenkins/recipes/jenkins_master.rb

 96:     jenkins_private_key_credentials credential["name"] do
 97:       description credential["description"]
 98:       private_key data_bag["#{credential["databag_key_name"]}"]
 99:       if credential["id"]
100:         id credential["id"]
101:       end

================================================================================
Error executing action create on resource
’jenkins_private_key_credentials[user_build]’

================================================================================

Mixlib::ShellOut::CommandTimeout
--------------------------------
Command timed out after 60s:
Command exceeded allowed execution time, process terminated
---- Begin output of "/usr/lib/jvm/java/bin/java" -jar

“/var/chef/cache/jenkins-cli.jar” -s http://localhost:8080 -i
"/var/chef/cache/jenkins-key" groovy /tmp/groovy20150505-27740-1o9e28c ----
STDOUT:
STDERR:
---- End output of “/usr/lib/jvm/java/bin/java” -jar
"/var/chef/cache/jenkins-cli.jar" -s http://localhost:8080 -i
"/var/chef/cache/jenkins-key" groovy /tmp/groovy20150505-27740-1o9e28c ----
Ran “/usr/lib/jvm/java/bin/java” -jar “/var/chef/cache/jenkins-cli.jar”
-s http://localhost:8080 -i “/var/chef/cache/jenkins-key” groovy
/tmp/groovy20150505-27740-1o9e28c returned 143

Cookbook Trace:
---------------

/home/ec2-user/chef-solo/cookbooks-2/jenkins/libraries/_executor.rb:81:in
`execute!’

/home/ec2-user/chef-solo/cookbooks-2/jenkins/libraries/_executor.rb:127:in
`groovy!’

/home/ec2-user/chef-solo/cookbooks-2/jenkins/libraries/credentials.rb:205:in
`current_credentials’

/home/ec2-user/chef-solo/cookbooks-2/jenkins/libraries/credentials_private_key.rb:117:in
`current_credentials’

/home/ec2-user/chef-solo/cookbooks-2/jenkins/libraries/credentials.rb:79:in
`load_current_resource’

/home/ec2-user/chef-solo/cookbooks-2/jenkins/libraries/credentials_private_key.rb:69:in
`load_current_resource’


Regards
nirish okram


#2

On Tuesday, May 5, 2015 at 10:08 PM, niristotle okram wrote:

i have this recipe for jenkins and i am trying to use it on an aws node for some test. i am using using chef-solo & knife-sole.

The point of failure is in this part of the recipe (the highlighted)

================================================================================
Error executing action create on resource ‘jenkins_private_key_credentials[user_build]’

Mixlib::ShellOut::CommandTimeout

Command timed out after 60s:
Command exceeded allowed execution time, process terminated
---- Begin output of “/usr/lib/jvm/java/bin/java” -jar “/var/chef/cache/jenkins-cli.jar” -s http://localhost:8080 -i “/var/chef/cache/jenkins-key” groovy /tmp/groovy20150505-27740-1o9e28c ----
STDOUT:
STDERR:
---- End output of “/usr/lib/jvm/java/bin/java” -jar “/var/chef/cache/jenkins-cli.jar” -s http://localhost:8080 -i “/var/chef/cache/jenkins-key” groovy /tmp/groovy20150505-27740-1o9e28c ----
Ran “/usr/lib/jvm/java/bin/java” -jar “/var/chef/cache/jenkins-cli.jar” -s http://localhost:8080 -i “/var/chef/cache/jenkins-key” groovy /tmp/groovy20150505-27740-1o9e28c returned 143

This command is not returning after 60s, and it’s not producing any output to explain why. If you expect that the command should take longer than 60s, then you need to increase the timeout (you might have to edit the cookbook’s provider code for this). If the command is supposed to run in a much shorter time, then there’s probably a network issue where the packets are getting silently dropped (this is common behavior for firewalls, in order to make port scans slower/less reliable, but there’s other ways this behavior can occur also). Of course a network issue seems a lot less likely on localhost.


Regards
nirish okram


Daniel DeLeo


#3

thanks, let me try with an aws instance type: m3.medium where the n/w
performance is moderate. If this fails, i will check if i can find where
the timeout of 60secs is set in the cookbook.

ps: i love chef but Ruby is not by best fren yet :slight_smile:

On Thu, May 7, 2015 at 8:30 AM, Daniel DeLeo dan@kallistec.com wrote:

On Tuesday, May 5, 2015 at 10:08 PM, niristotle okram wrote:

i have this recipe for jenkins and i am trying to use it on an aws node
for some test. i am using using chef-solo & knife-sole.

The point of failure is in this part of the recipe (the highlighted)

================================================================================

Error executing action create on resource
’jenkins_private_key_credentials[user_build]’

================================================================================

Mixlib::ShellOut::CommandTimeout

Command timed out after 60s:
Command exceeded allowed execution time, process terminated
---- Begin output of “/usr/lib/jvm/java/bin/java” -jar
"/var/chef/cache/jenkins-cli.jar" -s http://localhost:8080 -i
"/var/chef/cache/jenkins-key" groovy /tmp/groovy20150505-27740-1o9e28c ----
STDOUT:
STDERR:
---- End output of “/usr/lib/jvm/java/bin/java” -jar
"/var/chef/cache/jenkins-cli.jar" -s http://localhost:8080 -i
"/var/chef/cache/jenkins-key" groovy /tmp/groovy20150505-27740-1o9e28c ----
Ran “/usr/lib/jvm/java/bin/java” -jar “/var/chef/cache/jenkins-cli.jar”
-s http://localhost:8080 -i “/var/chef/cache/jenkins-key” groovy
/tmp/groovy20150505-27740-1o9e28c returned 143

This command is not returning after 60s, and it’s not producing any output
to explain why. If you expect that the command should take longer than
60s, then you need to increase the timeout (you might have to edit the
cookbook’s provider code for this). If the command is supposed to run in a
much shorter time, then there’s probably a network issue where the packets
are getting silently dropped (this is common behavior for firewalls, in
order to make port scans slower/less reliable, but there’s other ways this
behavior can occur also). Of course a network issue seems a lot less likely
on localhost.


Regards
nirish okram


Daniel DeLeo


Regards
nirish okram