Closed Tetha closed 5 years ago
Hey There It looks like this is the first issue you've filed against the chef-cookbooks project. I'm here to offer you a bit of extra help to make sure we can quickly get back to you. Make sure you've filled out all the fields in our issue template. Make sure you've provided us with the version of chef-client you're running, your operating system and the version of the cookbook. If you're not using the most up to date version of the cookbook then please make sure to update first. Lots of things change between versions even if you're issue isn't listed in the changelog. Finally please give us a detailed description of the issue you're having. The more we know about what you're trying to do, what actually happens, and how you can reproduce the problem, the better.
If you're looking for more immediate troubleshooting help make sure to check out #general on the Chef Community Slack. There's plenty of folks there willing to lend a helping hand. Thanks for the first issue. We hope we can get back to you soon with a solution.
@Tetha Any chance you can try this on the latest ChefSpec?
Yeah sure, I'll do some digging tomorrow or thursday depending on the maintenance work tonight. It shouldn't take too much time switching between a couple of chefdks on a VM to see if a specific version of chefspec broke something. I just didn't have time for further digging today.
I am running into this same error with runit 5.0.0 using chef-client 13.8.5 (not chefspec)
Error Log & Stacktrace
undefined method `find_resource' for Chef::Resource::RunitService
Backtrace
----------------------------------------------------
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/resource.rb:1297:in `method_missing'
/var/chef/cache/cookbooks/runit/libraries/resource_runit_service.rb:97:in `after_created'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/resource_builder.rb:73:in `build'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/dsl/declare_resource.rb:293:in `build_resource'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/dsl/declare_resource.rb:250:in `declare_resource'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/dsl/resources.rb:38:in `runit_service'
/var/chef/cache/cookbooks/jenkins/recipes/_master_war.rb:70:in `from_file'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/mixin/from_file.rb:30:in `instance_eval'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/mixin/from_file.rb:30:in `from_file'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/cookbook_version.rb:205:in `load_recipe'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/run_context.rb:342:in `load_recipe'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/run_context/cookbook_compiler.rb:163:in `block in compile_recipes'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/run_context/cookbook_compiler.rb:160:in `each'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/run_context/cookbook_compiler.rb:160:in `compile_recipes'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/run_context/cookbook_compiler.rb:77:in `compile'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/run_context.rb:191:in `load'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/policy_builder/expand_node_object.rb:97:in `setup_run_context'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/client.rb:513:in `setup_run_context'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/client.rb:281:in `run'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/application.rb:292:in `block in fork_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/application.rb:280:in `fork'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/application.rb:280:in `fork_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/application.rb:245:in `block in run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/local_mode.rb:44:in `with_server_connectivity'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/application.rb:233:in `run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/application/client.rb:469:in `sleep_then_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/application/client.rb:458:in `block in interval_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/application/client.rb:457:in `loop'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/application/client.rb:457:in `interval_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/application/client.rb:441:in `run_application'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/lib/chef/application.rb:59:in `run'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5/bin/chef-client:26:in `<top (required)>'
/usr/bin/chef-client:59:in `load'
/usr/bin/chef-client:59:in `<main>'
The fix here is to either pin on the 4.0 cookbook or to upgrade ChefDK to the latest version. It turns out the old ChefSpec had some bugs and couldn't handle this resource.
it doesn't seem right to close this issue when it's affecting chef-client as well, not just chefspec. The changelog says This cookbook now requires Chef 13 or later
which 13.8.5 falls under. What version is required for this to work properly?
@amcappelli 🤦♂️ yep. This cookbook now requires Chef 14. I've updated the metadata and released a 5.0.1 release. You'll need to stick with the previous major release or upgrade your chef-client. Keep in mind that Chef 13 goes EOL the first week or April and won't get security updates or bug fixes after that date.
Cookbook version
runit-5.0.0
Chef-client version
13.8.5
Platform Details
We're running these tests on Fedora 29 and Centos 7.x. Both tests run with the chefdk 2.5.3, which provides chef 13.8.5 and chefspec 7.1.2.
Scenario:
Our CI has picked up failing unit tests in our cookbooks. Practically, this has hit internal cookbooks depending on the jenkins cookbook first, since the jenkins cookbook uses the runit cookbook for service management. However, I've created a reproduction cookbook which uses runit alone.
Steps to Reproduce:
Create the following test cookbook:
At this point, run
chef exec berks install
followed bychef exec rspec test/spec
.Expected Result:
I'd expect this minimal example to pass the tests, especially given that there are zero assertions.
Actual Result:
This exception occurs:
Am I missing something horrible here?