chef-cookbooks / runit

Development repository for the Chef Runit Cookbook
https://supermarket.chef.io/cookbooks/runit
Apache License 2.0
106 stars 197 forks source link

superclass mismatch for class RunitService #227

Closed coltrey closed 6 years ago

coltrey commented 6 years ago

Is this somehow my fault? I tried to build a branch that has not had changes since its last successful build (12 days ago) and it failed with the error below.

Cookbook version

4.0.1

Chef-client version

12.21.2

Platform Details

platform=centos platform_version=5.11 AWS/Amazon Linux

Scenario:

Trying to run unit tests (chef exec rspec) on a wrapper cookbook around the community jenkins cookbook, which depends on runit.

Steps to Reproduce:

executing chef exec rspec in our CI environment

Expected Result:

Tests should compile/pass

Actual Result:

================================================================================
Recipe Compile Error in /tmp/d20171129-57-ijge3h/cookbooks/runit/libraries/resource_runit_service.rb
================================================================================

TypeError
---------
superclass mismatch for class RunitService

Cookbook Trace:
---------------
  /tmp/d20171129-57-ijge3h/cookbooks/runit/libraries/resource_runit_service.rb:27:in `<class:Resource>'
  /tmp/d20171129-57-ijge3h/cookbooks/runit/libraries/resource_runit_service.rb:25:in `<class:Chef>'
  /tmp/d20171129-57-ijge3h/cookbooks/runit/libraries/resource_runit_service.rb:24:in `<top (required)>'

Relevant File Content:
----------------------
/tmp/d20171129-57-ijge3h/cookbooks/runit/libraries/resource_runit_service.rb:

 20:  
 21:  require 'chef/resource'
 22:  require 'chef/resource/service'
 23:  
 24:  class Chef
 25:    class Resource
 26:      # Missing top-level class documentation comment
 27>>     class RunitService < Chef::Resource::Service
 28:        def initialize(name, run_context = nil)
 29:          super
 30:          runit_node = runit_attributes_from_node(run_context)
 31:          @resource_name = :runit_service
 32:          @provider = Chef::Provider::RunitService
 33:          @supports = { restart: true, reload: true, status: true }
 34:          @action = :enable
 35:          @allowed_actions = [:nothing, :start, :stop, :enable, :disable, :restart, :reload, :status, :once, :hup, :cont, :term, :kill, :up, :down, :usr1, :usr2, :create]
 36:  

System Info:
------------
chef_version=12.21.2
platform=centos
platform_version=5.11
ruby=ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
program_name=/opt/chefdk/embedded/bin/rspec
executable=/opt/chefdk/embedded/bin/rspec
coderanger commented 6 years ago

Is there anything in your wrapper (under libraries/) which is modifying the class?

tas50 commented 6 years ago

@coltrey What version of the jenkins cookbook are you on?

coltrey commented 6 years ago

@coderanger I do not have a libraries/ directory in my cookbook. @tas50 cookbook 'jenkins', '~> 5.0.2'

tas50 commented 6 years ago

Pretty positive I found the root cause here. Some code slipped into a commit. I'll have 4.0.3 out in a few minutes for you.

tas50 commented 6 years ago

This wasn't noticed since we run the tests against chef 13 and this only occurs in the old 12 code

coltrey commented 6 years ago

Thank you.

coltrey commented 6 years ago

I've confirmed this is not an issue in 4.0.3