sedward
sedward

Reputation: 31

Chef Bash Resource Not Running

I've currently created a custom lwrp that essentially runs a bash script that curls for the localhost after tomcat restarts to make the sure the service is running.

My provider file looks like this:

use_inline_resources

action :run do
  bash "checkhealth" do
  user "root"
  code <<-EOF
    echo Started counting
    curl http://localhost/version.html
  ...
  EOF
  end
 end

On one of my nodes, I have the following block:

service "node" do
  supports :start => true, :stop => true, :restart => true, :status => true
  action :nothing
  notifies :run, "healthcheck[check-status]", :delayed
end

And when i run chef-client, I can see the echos from the bash code running.

However, on a different node, I have a block like this:

service "tomcat" do
  action :restart
  notifies :run, "healthcheck[check-status]", :delayed
end

But I can't see any output from the echo and it doesn't look like the bash code is running. I know the bash resource is being executed because the log output says the bash resource was successfully run. However, there is a very long delay after the log says:

action run[2014-07-23T09:10:23-07:00] INFO: Processing bash[checkhealth] action run

and when it says it was successful, which makes me think something weird is going on with the bash code, but I'm not sure what. This is where I'm stuck and hoping you guys could help me figure out this weird bug :). I'm guessing it may have something to do with the fact that in the first block, the action is :nothing, but the second block has :restart.

Let me know what you guys think.

Thanks!

Upvotes: 2

Views: 779

Answers (1)

Mark O&#39;Connor
Mark O&#39;Connor

Reputation: 78011

Why not emulate what the old Jenkins cookbook (v1.2.2) used to do?

See:

Upvotes: -1

Related Questions