Skip to content

Fix notification reference to runit service, delay notification until end of chef run #23

Merged
merged 1 commit into from Sep 10, 2013

5 participants

@awestendorf

Fixes the reference to the runit service, fixing the following bug:

FATAL: Chef::Exceptions::ResourceNotFound: resource git[/usr/share/statsd] is configured to notify resource runit_service[statsd] with action restart, but runit_service[statsd] cannot be found in the resource collection. git[/usr/share/statsd] is defined in /var/cache/chef/cookbooks/statsd/recipes/default.rb:5:in `from_file'

Added the delay flag to consolidate multiple restarts when code and configuration are deployed

@hectcastro
Owner

Hey @awestendorf, do you happen to know why this wasn't being caught by the Test Kichen suite? Is it due to an older version of the runit cookbook? #20

Also, does using the service resource just leverage runit's init.d stubs, or is it absorbing runit's resource?

@awestendorf

Good question, I didn't have time this morning to investigate more deeply and try out all the cases. I'll try to work on that later.

@jayTandalai

Is this solution going to be accepted? or is there another fix coming along for this?

@hectcastro
Owner

I'm willing to merge it as soon as I can find a way to reproduce the error. I have not been able to with the test suite included in this cookbook.

@awestendorf

I gathered that recent versions of runit fixed the problem.

@jayTandalai

Opscode's version works. Unfortunately Amazon Opsworks' does not and when this cookbook is deployed on amazon opswroks' linux, Opsworks keeps resolving to it's default runit cookbook which fails. The fix suggested does not work either for that matter on Opsworks linux AMi based instances.

@hectcastro
Owner

@jayTandalai If you can provide a different fix or more details on the type of error produced, that would be great.

@robbkidd

I don't know how to help replicate in tests, but here's what I know. I had Berksfile that specified statsd cookbook at v1.1.3. berks install brought in runit at version 0.16.2. My chef-solo run failed with the error given in this PR:

Chef::Exceptions::ResourceNotFound: resource git[/usr/share/statsd] is 
configured to notify resource runit_service[statsd] with action restart, but
runit_service[statsd] cannot be found in the resource collection. git[/usr/share/statsd]
is defined in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/statsd/recipes/default.rb:5:in
`from_file'

A coworker's setup was working. He had run berks install and berks update and was using runit verison 1.0.4. Adding an entry for runit and version ~> 1.0.4 got me version 1.0.6. The chef-solo run would then get past this error.

@jayTandalai

@hectcastro : I get the same exception as listed by @robbkidd when I try it without this suggested fix. And when I run it with the suggested fix(Using service instead of runit_service) it's delegating to amazon's core runit which silently fails(aws/opsworks-cookbooks#23) and I end up getting this exception:

  • Chef::Exceptions::EnclosingDirectoryDoesNotExist occurred in chef run: directory/etc/sv/statsd had an error: Chef::Exceptions::EnclosingDirectoryDoesNotExist: Parent directory /etc/sv does not exist, cannot create /etc/sv/statsd

And like I said earlier even if I configure my Berkshelf to use Opscode's recipe, for some reason Opsworks keeps resolving to it's core runit cookbook, so trying any version of Opscode's is not an option for me.

The only time I got it to work is when I deleted Opsworks' default runit cookbook from the instance and executed the recipe.

I 'll see if I can find a fix for this. If anybody has a suggestion, you are welcome. This happens on Opsworks Amazon linux ami.

@jtescher
jtescher commented Sep 9, 2013

I ran into the same issue with OpsWorks and Chef 11.4 as @awestendorf described above. Switching to "service[statsd]", :delayed fixed it and it works great. (runit 1.1.2 for what it's worth).

Either merging this in or some other official fix would be nice though.

@hectcastro hectcastro merged commit a0563b5 into hectcastro:master Sep 10, 2013

1 check passed

Details default The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.