Error executing action `run` - jenkins_cli


#1

Not sure why I can’t call this jenkins_cli command (it’s literally from the sample code on github. Could it be authentication related?

In my cookbook: recipes/jenkins.rb

include_recipe “jenkins”

%w{ git github }.each do |plugin|
jenkins_cli "install-plugin #{plugin}"
jenkins_cli "safe-restart"
end

Chef Solo output:

* jenkins_execute[java -jar /home/jenkins/jenkins-cli.jar -s http://syncopated-soaring:8080 install-plugin git] action run

================================================================================
Error executing action run on resource ‘jenkins_execute[java -jar /home/jenkins/jenkins-cli.jar -s http://syncopated-soaring:8080 install-plugin git]’

Chef::Exceptions::Exec

java -jar /home/jenkins/jenkins-cli.jar -s http://syncopated-soaring:8080 install-plugin git returned 1, expected 0

Cookbook Trace:

/root/chef-solo/cookbooks-1/jenkins/providers/execute.rb:46:in `action_run’

Resource Declaration:

In /root/chef-solo/cookbooks-1/jenkins/providers/cli.rb

49:   jenkins_execute command do
50:     cwd home
51:     block { |stdout| new_resource.block.call(stdout) } if new_resource.block
52:   end
53: end

Compiled Resource:

Declared in /root/chef-solo/cookbooks-1/jenkins/providers/cli.rb:49:in `action_run’

jenkins_execute(“java -jar /home/jenkins/jenkins-cli.jar -s http://syncopated-soaring:8080 install-plugin git”) do
action :run
retries 0
retry_delay 2
command "java -jar /home/jenkins/jenkins-cli.jar -s http://syncopated-soaring:8080 install-plugin git"
cookbook_name :rackbox
cwd "/home/jenkins"
end

[2013-09-06T16:12:03+00:00] ERROR: Running exception handlers
[2013-09-06T16:12:03+00:00] ERROR: Exception handlers complete
[2013-09-06T16:12:03+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 5 resources updated
[2013-09-06T16:12:03+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)


#2

I thought maybe it’s an issue with the 'hostname which doesn’t resolve, but I tried changing it to the ip address and it still doesn’t work.

On Sep 6, 2013, at 12:15 PM, Michael Hayes hayesmp@thefrontside.net wrote:

Not sure why I can’t call this jenkins_cli command (it’s literally from the sample code on github. Could it be authentication related?

In my cookbook: recipes/jenkins.rb

include_recipe “jenkins”

%w{ git github }.each do |plugin|
jenkins_cli "install-plugin #{plugin}"
jenkins_cli "safe-restart"
end

Chef Solo output:

  • jenkins_execute[java -jar /home/jenkins/jenkins-cli.jar -s http://syncopated-soaring:8080 install-plugin git] action run
    ================================================================================
    Error executing action run on resource ‘jenkins_execute[java -jar /home/jenkins/jenkins-cli.jar -s http://syncopated-soaring:8080 install-plugin git]’
    ================================================================================

Chef::Exceptions::Exec

java -jar /home/jenkins/jenkins-cli.jar -s http://syncopated-soaring:8080 install-plugin git returned 1, expected 0

Cookbook Trace:

/root/chef-solo/cookbooks-1/jenkins/providers/execute.rb:46:in `action_run’

Resource Declaration:

In /root/chef-solo/cookbooks-1/jenkins/providers/cli.rb

49: jenkins_execute command do
50: cwd home
51: block { |stdout| new_resource.block.call(stdout) } if new_resource.block
52: end
53: end

Compiled Resource:

Declared in /root/chef-solo/cookbooks-1/jenkins/providers/cli.rb:49:in `action_run’

jenkins_execute(“java -jar /home/jenkins/jenkins-cli.jar -s http://syncopated-soaring:8080 install-plugin git”) do
action :run
retries 0
retry_delay 2
command "java -jar /home/jenkins/jenkins-cli.jar -s http://syncopated-soaring:8080 install-plugin git"
cookbook_name :rackbox
cwd "/home/jenkins"
end

[2013-09-06T16:12:03+00:00] ERROR: Running exception handlers
[2013-09-06T16:12:03+00:00] ERROR: Exception handlers complete
[2013-09-06T16:12:03+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 5 resources updated
[2013-09-06T16:12:03+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)


#3

Try running chef with -l debug for more verbose output about the error. There are some changes to the jenkins cookbook that will make errors like this more informative, there should be a new release pretty soon.


Daniel DeLeo

On Friday, September 6, 2013 at 11:49 AM, Michael Hayes wrote:

I thought maybe it’s an issue with the 'hostname which doesn’t resolve, but I tried changing it to the ip address and it still doesn’t work.

On Sep 6, 2013, at 12:15 PM, Michael Hayes <hayesmp@thefrontside.net (mailto:hayesmp@thefrontside.net)> wrote:

Not sure why I can’t call this jenkins_cli command (it’s literally from the sample code on github. Could it be authentication related?

In my cookbook: recipes/jenkins.rb

include_recipe “jenkins”

%w{ git github }.each do |plugin|
jenkins_cli "install-plugin #{plugin}"
jenkins_cli "safe-restart"
end

Chef Solo output:

  • jenkins_execute[java -jar /home/jenkins/jenkins-cli.jar -s http://syncopated-soaring:8080 install-plugin git] action run
    ================================================================================
    Error executing action run on resource ‘jenkins_execute[java -jar /home/jenkins/jenkins-cli.jar -s http://syncopated-soaring:8080 install-plugin git]’
    ================================================================================

Chef::Exceptions::Exec

java -jar /home/jenkins/jenkins-cli.jar -s http://syncopated-soaring:8080 install-plugin git returned 1, expected 0

Cookbook Trace:

/root/chef-solo/cookbooks-1/jenkins/providers/execute.rb:46:in `action_run’

Resource Declaration:

In /root/chef-solo/cookbooks-1/jenkins/providers/cli.rb

49: jenkins_execute command do
50: cwd home
51: block { |stdout| new_resource.block.call(stdout) } if new_resource.block
52: end
53: end

Compiled Resource:

Declared in /root/chef-solo/cookbooks-1/jenkins/providers/cli.rb:49:in `action_run’

jenkins_execute(“java -jar /home/jenkins/jenkins-cli.jar -s http://syncopated-soaring:8080 install-plugin git”) do
action :run
retries 0
retry_delay 2
command "java -jar /home/jenkins/jenkins-cli.jar -s http://syncopated-soaring:8080 install-plugin git"
cookbook_name :rackbox
cwd "/home/jenkins"
end

[2013-09-06T16:12:03+00:00] ERROR: Running exception handlers
[2013-09-06T16:12:03+00:00] ERROR: Exception handlers complete
[2013-09-06T16:12:03+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 5 resources updated
[2013-09-06T16:12:03+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)


#4

It appears to have worked correctly when i used the verbose output option for knife solo:

  • jenkins_execute[java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git] action run[2013-09-06T19:26:37+00:00] INFO: Processing jenkins_execute[java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git] action run (/root/chef-solo/cookbooks-1/jenkins/providers/cli.rb line 49)
    [2013-09-06T19:26:37+00:00] DEBUG: Platform ubuntu version 12.04 found
    [2013-09-06T19:26:37+00:00] DEBUG: Executing java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git

    (skipped due to not_if)
    [2013-09-06T19:26:37+00:00] DEBUG: Skipping remote_file[/home/jenkins/jenkins-cli.jar] due to not_if ruby block

    • jenkins_execute[java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git] action run[2013-09-06T19:26:37+00:00] INFO: Processing jenkins_execute[java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git] action run (/root/chef-solo/cookbooks-1/jenkins/providers/cli.rb line 49)
      [2013-09-06T19:26:37+00:00] DEBUG: Platform ubuntu version 12.04 found
      [2013-09-06T19:26:37+00:00] DEBUG: Executing java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git
      DEBUG: sudo -p 'knife sudo password: ’ chef-solo -c ~/chef-solo/solo.rb -j ~/chef-solo/dna.json -l debug stdout: [2013-09-06T19:26:58+00:00] DEBUG: ---- Begin output of java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git ----

    [2013-09-06T19:26:58+00:00] DEBUG: ---- Begin output of java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git ----
    DEBUG: sudo -p 'knife sudo password: ’ chef-solo -c ~/chef-solo/solo.rb -j ~/chef-solo/dna.json -l debug stdout: [2013-09-06T19:26:58+00:00] DEBUG: STDOUT: Installing git from update center

    [2013-09-06T19:26:58+00:00] DEBUG: STDOUT: Installing git from update center
    DEBUG: sudo -p 'knife sudo password: ’ chef-solo -c ~/chef-solo/solo.rb -j ~/chef-solo/dna.json -l debug stdout: [2013-09-06T19:26:58+00:00] DEBUG: STDERR:

    [2013-09-06T19:26:58+00:00] DEBUG: STDERR:
    DEBUG: sudo -p 'knife sudo password: ’ chef-solo -c ~/chef-solo/solo.rb -j ~/chef-solo/dna.json -l debug stdout: [2013-09-06T19:26:58+00:00] DEBUG: ---- End output of java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git ----

    [2013-09-06T19:26:58+00:00] DEBUG: ---- End output of java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git ----
    DEBUG: sudo -p 'knife sudo password: ’ chef-solo -c ~/chef-solo/solo.rb -j ~/chef-solo/dna.json -l debug stdout: [2013-09-06T19:26:58+00:00] DEBUG: Ran java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git returned 0

    [2013-09-06T19:26:58+00:00] DEBUG: Ran java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git returned 0
    DEBUG: sudo -p 'knife sudo password: ’ chef-solo -c ~/chef-solo/solo.rb -j ~/chef-solo/dna.json -l debug stdout: [2013-09-06T19:26:58+00:00] INFO: Ran jenkins_execute[java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git] successfully

    [2013-09-06T19:26:58+00:00] INFO: Ran jenkins_execute[java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git] successfully
    DEBUG: sudo -p 'knife sudo password: ’ chef-solo -c ~/chef-solo/solo.rb -j ~/chef-solo/dna.json -l debug stdout:

    DEBUG: sudo -p 'knife sudo password: ’ chef-solo -c ~/chef-solo/solo.rb -j ~/chef-solo/dna.json -l debug stdout:

    DEBUG: sudo -p 'knife sudo password: ’ chef-solo -c ~/chef-solo/solo.rb -j ~/chef-solo/dna.json -l debug stdout: Recipe: rackbox::jenkins
    Recipe: rackbox::jenkinsDEBUG: sudo -p 'knife sudo password: ’ chef-solo -c ~/chef-solo/solo.rb -j ~/chef-solo/dna.json -l debug stdout:
    On Sep 6, 2013, at 1:56 PM, Daniel DeLeo dan@kallistec.com wrote:

Try running chef with -l debug for more verbose output about the error. There are some changes to the jenkins cookbook that will make errors like this more informative, there should be a new release pretty soon.


Daniel DeLeo

On Friday, September 6, 2013 at 11:49 AM, Michael Hayes wrote:

I thought maybe it’s an issue with the 'hostname which doesn’t resolve, but I tried changing it to the ip address and it still doesn’t work.

On Sep 6, 2013, at 12:15 PM, Michael Hayes hayesmp@thefrontside.net wrote:

Not sure why I can’t call this jenkins_cli command (it’s literally from the sample code on github. Could it be authentication related?

In my cookbook: recipes/jenkins.rb

include_recipe “jenkins”

%w{ git github }.each do |plugin|
jenkins_cli "install-plugin #{plugin}"
jenkins_cli "safe-restart"
end

Chef Solo output:

  • jenkins_execute[java -jar /home/jenkins/jenkins-cli.jar -s http://syncopated-soaring:8080 install-plugin git] action run
    ================================================================================
    Error executing action run on resource ‘jenkins_execute[java -jar /home/jenkins/jenkins-cli.jar -s http://syncopated-soaring:8080 install-plugin git]’
    ================================================================================

Chef::Exceptions::Exec

java -jar /home/jenkins/jenkins-cli.jar -s http://syncopated-soaring:8080 install-plugin git returned 1, expected 0

Cookbook Trace:

/root/chef-solo/cookbooks-1/jenkins/providers/execute.rb:46:in `action_run’

Resource Declaration:

In /root/chef-solo/cookbooks-1/jenkins/providers/cli.rb

49: jenkins_execute command do
50: cwd home
51: block { |stdout| new_resource.block.call(stdout) } if new_resource.block
52: end
53: end

Compiled Resource:

Declared in /root/chef-solo/cookbooks-1/jenkins/providers/cli.rb:49:in `action_run’

jenkins_execute(“java -jar /home/jenkins/jenkins-cli.jar -s http://syncopated-soaring:8080 install-plugin git”) do
action :run
retries 0
retry_delay 2
command "java -jar /home/jenkins/jenkins-cli.jar -s http://syncopated-soaring:8080 install-plugin git"
cookbook_name :rackbox
cwd "/home/jenkins"
end

[2013-09-06T16:12:03+00:00] ERROR: Running exception handlers
[2013-09-06T16:12:03+00:00] ERROR: Exception handlers complete
[2013-09-06T16:12:03+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 5 resources updated
[2013-09-06T16:12:03+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)


#5

Nope. It worked that one time and I have no idea why…

On Sep 6, 2013, at 2:37 PM, Michael Hayes hayesmp@thefrontside.net wrote:

It appears to have worked correctly when i used the verbose output option for knife solo:

  • jenkins_execute[java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git] action run[2013-09-06T19:26:37+00:00] INFO: Processing jenkins_execute[java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git] action run (/root/chef-solo/cookbooks-1/jenkins/providers/cli.rb line 49)
    [2013-09-06T19:26:37+00:00] DEBUG: Platform ubuntu version 12.04 found
    [2013-09-06T19:26:37+00:00] DEBUG: Executing java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git

    (skipped due to not_if)
    [2013-09-06T19:26:37+00:00] DEBUG: Skipping remote_file[/home/jenkins/jenkins-cli.jar] due to not_if ruby block

    • jenkins_execute[java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git] action run[2013-09-06T19:26:37+00:00] INFO: Processing jenkins_execute[java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git] action run (/root/chef-solo/cookbooks-1/jenkins/providers/cli.rb line 49)
      [2013-09-06T19:26:37+00:00] DEBUG: Platform ubuntu version 12.04 found
      [2013-09-06T19:26:37+00:00] DEBUG: Executing java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git
      DEBUG: sudo -p 'knife sudo password: ’ chef-solo -c ~/chef-solo/solo.rb -j ~/chef-solo/dna.json -l debug stdout: [2013-09-06T19:26:58+00:00] DEBUG: ---- Begin output of java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git ----

    [2013-09-06T19:26:58+00:00] DEBUG: ---- Begin output of java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git ----
    DEBUG: sudo -p 'knife sudo password: ’ chef-solo -c ~/chef-solo/solo.rb -j ~/chef-solo/dna.json -l debug stdout: [2013-09-06T19:26:58+00:00] DEBUG: STDOUT: Installing git from update center

    [2013-09-06T19:26:58+00:00] DEBUG: STDOUT: Installing git from update center
    DEBUG: sudo -p 'knife sudo password: ’ chef-solo -c ~/chef-solo/solo.rb -j ~/chef-solo/dna.json -l debug stdout: [2013-09-06T19:26:58+00:00] DEBUG: STDERR:

    [2013-09-06T19:26:58+00:00] DEBUG: STDERR:
    DEBUG: sudo -p 'knife sudo password: ’ chef-solo -c ~/chef-solo/solo.rb -j ~/chef-solo/dna.json -l debug stdout: [2013-09-06T19:26:58+00:00] DEBUG: ---- End output of java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git ----

    [2013-09-06T19:26:58+00:00] DEBUG: ---- End output of java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git ----
    DEBUG: sudo -p 'knife sudo password: ’ chef-solo -c ~/chef-solo/solo.rb -j ~/chef-solo/dna.json -l debug stdout: [2013-09-06T19:26:58+00:00] DEBUG: Ran java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git returned 0

    [2013-09-06T19:26:58+00:00] DEBUG: Ran java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git returned 0
    DEBUG: sudo -p 'knife sudo password: ’ chef-solo -c ~/chef-solo/solo.rb -j ~/chef-solo/dna.json -l debug stdout: [2013-09-06T19:26:58+00:00] INFO: Ran jenkins_execute[java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git] successfully

    [2013-09-06T19:26:58+00:00] INFO: Ran jenkins_execute[java -jar /home/jenkins/jenkins-cli.jar -s http://166.78.108.63:8080 install-plugin git] successfully
    DEBUG: sudo -p 'knife sudo password: ’ chef-solo -c ~/chef-solo/solo.rb -j ~/chef-solo/dna.json -l debug stdout:

    DEBUG: sudo -p 'knife sudo password: ’ chef-solo -c ~/chef-solo/solo.rb -j ~/chef-solo/dna.json -l debug stdout:

    DEBUG: sudo -p 'knife sudo password: ’ chef-solo -c ~/chef-solo/solo.rb -j ~/chef-solo/dna.json -l debug stdout: Recipe: rackbox::jenkins
    Recipe: rackbox::jenkinsDEBUG: sudo -p 'knife sudo password: ’ chef-solo -c ~/chef-solo/solo.rb -j ~/chef-solo/dna.json -l debug stdout:
    On Sep 6, 2013, at 1:56 PM, Daniel DeLeo dan@kallistec.com wrote:

Try running chef with -l debug for more verbose output about the error. There are some changes to the jenkins cookbook that will make errors like this more informative, there should be a new release pretty soon.


Daniel DeLeo

On Friday, September 6, 2013 at 11:49 AM, Michael Hayes wrote:

I thought maybe it’s an issue with the 'hostname which doesn’t resolve, but I tried changing it to the ip address and it still doesn’t work.

On Sep 6, 2013, at 12:15 PM, Michael Hayes hayesmp@thefrontside.net wrote:

Not sure why I can’t call this jenkins_cli command (it’s literally from the sample code on github. Could it be authentication related?

In my cookbook: recipes/jenkins.rb

include_recipe “jenkins”

%w{ git github }.each do |plugin|
jenkins_cli "install-plugin #{plugin}"
jenkins_cli "safe-restart"
end

Chef Solo output:

  • jenkins_execute[java -jar /home/jenkins/jenkins-cli.jar -s http://syncopated-soaring:8080 install-plugin git] action run
    ================================================================================
    Error executing action run on resource ‘jenkins_execute[java -jar /home/jenkins/jenkins-cli.jar -s http://syncopated-soaring:8080 install-plugin git]’
    ================================================================================

Chef::Exceptions::Exec

java -jar /home/jenkins/jenkins-cli.jar -s http://syncopated-soaring:8080 install-plugin git returned 1, expected 0

Cookbook Trace:

/root/chef-solo/cookbooks-1/jenkins/providers/execute.rb:46:in `action_run’

Resource Declaration:

In /root/chef-solo/cookbooks-1/jenkins/providers/cli.rb

49: jenkins_execute command do
50: cwd home
51: block { |stdout| new_resource.block.call(stdout) } if new_resource.block
52: end
53: end

Compiled Resource:

Declared in /root/chef-solo/cookbooks-1/jenkins/providers/cli.rb:49:in `action_run’

jenkins_execute(“java -jar /home/jenkins/jenkins-cli.jar -s http://syncopated-soaring:8080 install-plugin git”) do
action :run
retries 0
retry_delay 2
command "java -jar /home/jenkins/jenkins-cli.jar -s http://syncopated-soaring:8080 install-plugin git"
cookbook_name :rackbox
cwd "/home/jenkins"
end

[2013-09-06T16:12:03+00:00] ERROR: Running exception handlers
[2013-09-06T16:12:03+00:00] ERROR: Exception handlers complete
[2013-09-06T16:12:03+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 5 resources updated
[2013-09-06T16:12:03+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)