Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chef Client 12 introduces error: NoMethodError undefined method `new' for Chrome:Module #2575

Closed
dhoer opened this issue Dec 9, 2014 · 16 comments · Fixed by #2853
Closed
Milestone

Comments

@dhoer
Copy link

dhoer commented Dec 9, 2014

Chef Client 12 introduces error: NoMethodError undefined method `new' for Chrome:Module. I get the same error across platforms.

Here is the recipe that it is failing on: https://github.com/dhoer/chef-chrome/blob/master/test/fixtures/cookbooks/chrome_test/recipes/master_preferences.rb

~/chef/cookbooks/chrome$ kitchen verify 70
-----> Starting Kitchen (v1.2.1)
-----> Converging <chrome-test-centos-70>...
       Preparing files for transfer
       Resolving cookbook dependencies with Berkshelf 3.2.1...
       Removing non-cookbook files before transfer
       Transfering files to <chrome-test-centos-70>
       [2014-12-09T01:59:42+00:00] INFO: Forking chef instance to converge...
       Starting Chef Client, version 12.0.0
       [2014-12-09T01:59:42+00:00] INFO: *** Chef 12.0.0 ***
       [2014-12-09T01:59:42+00:00] INFO: Chef-client pid: 24516
       [2014-12-09T01:59:59+00:00] INFO: Setting the run_list to ["recipe[chrome_test::default]", "recipe[chrome_test::version]", "recipe[chrome_test::master_preferences]", "recipe[chrome_test::x11]"] from CLI options
       [2014-12-09T01:59:59+00:00] INFO: Run List is [recipe[chrome_test::default], recipe[chrome_test::version], recipe[chrome_test::master_preferences], recipe[chrome_test::x11]]
       [2014-12-09T01:59:59+00:00] INFO: Run List expands to [chrome_test::default, chrome_test::version, chrome_test::master_preferences, chrome_test::x11]
       [2014-12-09T01:59:59+00:00] INFO: Starting Chef Run for chrome-test-centos-70
       [2014-12-09T01:59:59+00:00] INFO: Running start handlers
       [2014-12-09T01:59:59+00:00] INFO: Start handlers complete.
       Compiling Cookbooks...
       [2014-12-09T01:59:59+00:00] INFO: Chrome light-weight provider is already initialized -- Skipping loading /tmp/kitchen/cookbooks/chrome/providers/default.rb!
       [2014-12-09T01:59:59+00:00] INFO: WindowsPackage light-weight resource is already initialized -- Skipping loading /tmp/kitchen/cookbooks/windows/resources/package.rb!
       Recipe: chrome_test::default
         * execute[apt-get update] action run[2014-12-09T01:59:59+00:00] INFO: Processing execute[apt-get update] action run (chrome_test::default line 1)
        (skipped due to only_if)
       Recipe: chrome::yum
         * yum_repository[google-chrome] action add[2014-12-09T01:59:59+00:00] INFO: Processing yum_repository[google-chrome] action add (chrome::yum line 1)

           * template[/etc/yum.repos.d/google-chrome.repo] action create[2014-12-09T01:59:59+00:00] INFO: Processing template[/etc/yum.repos.d/google-chrome.repo] action create (/tmp/kitchen/cookbooks/yum/providers/repository.rb line 39)
        (up to date)
           * execute[yum-makecache-google-chrome] action nothing[2014-12-09T01:59:59+00:00] INFO: Processing execute[yum-makecache-google-chrome] action nothing (/tmp/kitchen/cookbooks/yum/providers/repository.rb line 55)
        (skipped due to action :nothing)
           * ruby_block[yum-cache-reload-google-chrome] action nothing[2014-12-09T01:59:59+00:00] INFO: Processing ruby_block[yum-cache-reload-google-chrome] action nothing (/tmp/kitchen/cookbooks/yum/providers/repository.rb line 62)
        (skipped due to action :nothing)
            (up to date)
         * yum_package[google-chrome-stable] action install[2014-12-09T01:59:59+00:00] INFO: Processing yum_package[google-chrome-stable] action install (chrome::yum line 8)
        (up to date)
         Converging 6 resources
       Recipe: chrome_test::default
         * execute[apt-get update] action nothing[2014-12-09T02:00:01+00:00] INFO: Processing execute[apt-get update] action nothing (chrome_test::default line 1)
        (skipped due to action :nothing)
       Recipe: chrome::yum
         * yum_repository[google-chrome] action nothing[2014-12-09T02:00:01+00:00] INFO: Processing yum_repository[google-chrome] action nothing (chrome::yum line 1)
        (skipped due to action :nothing)
         * yum_package[google-chrome-stable] action nothing[2014-12-09T02:00:01+00:00] INFO: Processing yum_package[google-chrome-stable] action nothing (chrome::yum line 8)
        (skipped due to action :nothing)
       Recipe: chrome_test::version
         * log[chrome version] action write[2014-12-09T02:00:01+00:00] INFO: Processing log[chrome version] action write (chrome_test::version line 5)
       [2014-12-09T02:00:01+00:00] INFO: 39.0.2171.71


       Recipe: chrome_test::master_preferences
         * chrome[set_user_preferences] action master_preferences[2014-12-09T02:00:01+00:00] INFO: Processing chrome[set_user_preferences] action master_preferences (chrome_test::master_preferences line 1)


           ================================================================================
           Error executing action `master_preferences` on resource 'chrome[set_user_preferences]'
           ================================================================================

           NoMethodError
           -------------
           undefined method `new' for Chrome:Module

           Resource Declaration:
           ---------------------
           # In /tmp/kitchen/cookbooks/chrome_test/recipes/master_preferences.rb

             1: chrome 'set_user_preferences' do
             2:   cookbook 'chrome'
             3:   params(
             4:     homepage: 'https://www.getchef.com'
             5:   )
             6:   action :master_preferences
             7: end

           Compiled Resource:
           ------------------
           # Declared in /tmp/kitchen/cookbooks/chrome_test/recipes/master_preferences.rb:1:in `from_file'

           chrome("set_user_preferences") do
             params {:homepage=>"https://www.getchef.com"}
             action [:master_preferences]
             retries 0
             retry_delay 2
             default_guard_interpreter :default
             cookbook_name :chrome_test
             recipe_name "master_preferences"
             cookbook "chrome"
           end

       [2014-12-09T02:00:01+00:00] INFO: Running queued delayed notifications before re-raising exception

       Running handlers:
       [2014-12-09T02:00:01+00:00] ERROR: Running exception handlers
       Running handlers complete
       [2014-12-09T02:00:01+00:00] ERROR: Exception handlers complete
       [2014-12-09T02:00:01+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
       Chef Client failed. 1 resources updated in 19.645034043 seconds
[2014-12-09T02:00:01+00:00] ERROR: chrome[set_user_preferences] (chrome_test::master_preferences line 1) had an error: NoMethodError: undefined method `new' for Chrome:Module
       [2014-12-09T02:00:02+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
>>>>>> Converge failed on instance <chrome-test-centos-70>.
>>>>>> Please see .kitchen/logs/chrome-test-centos-70.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [sudo -E chef-solo --config /tmp/kitchen/solo.rb --json-attributes /tmp/kitchen/dna.json  --log_level info]
>>>>>> ----------------------

Kitchen Log

I, [2014-12-08T18:59:39.374368 #57373]  INFO -- chrome-test-centos-70: -----> Converging <chrome-test-centos-70>...
I, [2014-12-08T18:59:39.376129 #57373]  INFO -- chrome-test-centos-70: Preparing files for transfer
I, [2014-12-08T18:59:39.376471 #57373]  INFO -- chrome-test-centos-70: Resolving cookbook dependencies with Berkshelf 3.2.1...
I, [2014-12-08T18:59:40.787598 #57373]  INFO -- chrome-test-centos-70: Removing non-cookbook files before transfer
I, [2014-12-08T18:59:41.031531 #57373]  INFO -- chrome-test-centos-70: Transfering files to <chrome-test-centos-70>
I, [2014-12-08T18:59:42.432601 #57373]  INFO -- chrome-test-centos-70: [2014-12-09T01:59:42+00:00] INFO: Forking chef instance to converge...
I, [2014-12-08T18:59:42.499102 #57373]  INFO -- chrome-test-centos-70: Starting Chef Client, version 12.0.0�[0m
I, [2014-12-08T18:59:42.499178 #57373]  INFO -- chrome-test-centos-70: [2014-12-09T01:59:42+00:00] INFO: *** Chef 12.0.0 ***
I, [2014-12-08T18:59:42.499201 #57373]  INFO -- chrome-test-centos-70: [2014-12-09T01:59:42+00:00] INFO: Chef-client pid: 24516
I, [2014-12-08T18:59:59.989697 #57373]  INFO -- chrome-test-centos-70: [2014-12-09T01:59:59+00:00] INFO: Setting the run_list to ["recipe[chrome_test::default]", "recipe[chrome_test::version]", "recipe[chrome_test::master_preferences]", "recipe[chrome_test::x11]"] from CLI options
I, [2014-12-08T18:59:59.989763 #57373]  INFO -- chrome-test-centos-70: [2014-12-09T01:59:59+00:00] INFO: Run List is [recipe[chrome_test::default], recipe[chrome_test::version], recipe[chrome_test::master_preferences], recipe[chrome_test::x11]]
I, [2014-12-08T18:59:59.989786 #57373]  INFO -- chrome-test-centos-70: [2014-12-09T01:59:59+00:00] INFO: Run List expands to [chrome_test::default, chrome_test::version, chrome_test::master_preferences, chrome_test::x11]
I, [2014-12-08T18:59:59.989807 #57373]  INFO -- chrome-test-centos-70: [2014-12-09T01:59:59+00:00] INFO: Starting Chef Run for chrome-test-centos-70
I, [2014-12-08T18:59:59.989828 #57373]  INFO -- chrome-test-centos-70: [2014-12-09T01:59:59+00:00] INFO: Running start handlers
I, [2014-12-08T18:59:59.989880 #57373]  INFO -- chrome-test-centos-70: [2014-12-09T01:59:59+00:00] INFO: Start handlers complete.
I, [2014-12-08T19:00:00.022367 #57373]  INFO -- chrome-test-centos-70: Compiling Cookbooks...�[0m
I, [2014-12-08T19:00:00.033350 #57373]  INFO -- chrome-test-centos-70: [2014-12-09T01:59:59+00:00] INFO: Chrome light-weight provider is already initialized -- Skipping loading /tmp/kitchen/cookbooks/chrome/providers/default.rb!
I, [2014-12-08T19:00:00.044369 #57373]  INFO -- chrome-test-centos-70: [2014-12-09T01:59:59+00:00] INFO: WindowsPackage light-weight resource is already initialized -- Skipping loading /tmp/kitchen/cookbooks/windows/resources/package.rb!
I, [2014-12-08T19:00:00.066243 #57373]  INFO -- chrome-test-centos-70: Recipe: chrome_test::default�[0m
I, [2014-12-08T19:00:00.066357 #57373]  INFO -- chrome-test-centos-70:   * execute[apt-get update] action run[2014-12-09T01:59:59+00:00] INFO: Processing execute[apt-get update] action run (chrome_test::default line 1)
I, [2014-12-08T19:00:00.066416 #57373]  INFO -- chrome-test-centos-70:  (skipped due to only_if)
I, [2014-12-08T19:00:00.066440 #57373]  INFO -- chrome-test-centos-70: Recipe: chrome::yum�[0m
I, [2014-12-08T19:00:00.066462 #57373]  INFO -- chrome-test-centos-70:   * yum_repository[google-chrome] action add[2014-12-09T01:59:59+00:00] INFO: Processing yum_repository[google-chrome] action add (chrome::yum line 1)
I, [2014-12-08T19:00:00.066484 #57373]  INFO -- chrome-test-centos-70: 
I, [2014-12-08T19:00:00.066506 #57373]  INFO -- chrome-test-centos-70:     * template[/etc/yum.repos.d/google-chrome.repo] action create[2014-12-09T01:59:59+00:00] INFO: Processing template[/etc/yum.repos.d/google-chrome.repo] action create (/tmp/kitchen/cookbooks/yum/providers/repository.rb line 39)
I, [2014-12-08T19:00:00.074514 #57373]  INFO -- chrome-test-centos-70:  (up to date)
I, [2014-12-08T19:00:00.074579 #57373]  INFO -- chrome-test-centos-70:     * execute[yum-makecache-google-chrome] action nothing[2014-12-09T01:59:59+00:00] INFO: Processing execute[yum-makecache-google-chrome] action nothing (/tmp/kitchen/cookbooks/yum/providers/repository.rb line 55)
I, [2014-12-08T19:00:00.074621 #57373]  INFO -- chrome-test-centos-70:  (skipped due to action :nothing)
I, [2014-12-08T19:00:00.074652 #57373]  INFO -- chrome-test-centos-70:     * ruby_block[yum-cache-reload-google-chrome] action nothing[2014-12-09T01:59:59+00:00] INFO: Processing ruby_block[yum-cache-reload-google-chrome] action nothing (/tmp/kitchen/cookbooks/yum/providers/repository.rb line 62)
I, [2014-12-08T19:00:00.074673 #57373]  INFO -- chrome-test-centos-70:  (skipped due to action :nothing)
I, [2014-12-08T19:00:00.074693 #57373]  INFO -- chrome-test-centos-70:      (up to date)
I, [2014-12-08T19:00:00.074712 #57373]  INFO -- chrome-test-centos-70:   * yum_package[google-chrome-stable] action install[2014-12-09T01:59:59+00:00] INFO: Processing yum_package[google-chrome-stable] action install (chrome::yum line 8)
I, [2014-12-08T19:00:02.023800 #57373]  INFO -- chrome-test-centos-70:  (up to date)
I, [2014-12-08T19:00:02.069330 #57373]  INFO -- chrome-test-centos-70:   Converging 6 resources�[0m
I, [2014-12-08T19:00:02.069392 #57373]  INFO -- chrome-test-centos-70: Recipe: chrome_test::default�[0m
I, [2014-12-08T19:00:02.069416 #57373]  INFO -- chrome-test-centos-70:   * execute[apt-get update] action nothing[2014-12-09T02:00:01+00:00] INFO: Processing execute[apt-get update] action nothing (chrome_test::default line 1)
I, [2014-12-08T19:00:02.069456 #57373]  INFO -- chrome-test-centos-70:  (skipped due to action :nothing)
I, [2014-12-08T19:00:02.069476 #57373]  INFO -- chrome-test-centos-70: Recipe: chrome::yum�[0m
I, [2014-12-08T19:00:02.069496 #57373]  INFO -- chrome-test-centos-70:   * yum_repository[google-chrome] action nothing[2014-12-09T02:00:01+00:00] INFO: Processing yum_repository[google-chrome] action nothing (chrome::yum line 1)
I, [2014-12-08T19:00:02.069516 #57373]  INFO -- chrome-test-centos-70:  (skipped due to action :nothing)
I, [2014-12-08T19:00:02.069536 #57373]  INFO -- chrome-test-centos-70:   * yum_package[google-chrome-stable] action nothing[2014-12-09T02:00:01+00:00] INFO: Processing yum_package[google-chrome-stable] action nothing (chrome::yum line 8)
I, [2014-12-08T19:00:02.069556 #57373]  INFO -- chrome-test-centos-70:  (skipped due to action :nothing)
I, [2014-12-08T19:00:02.069575 #57373]  INFO -- chrome-test-centos-70: Recipe: chrome_test::version�[0m
I, [2014-12-08T19:00:02.069595 #57373]  INFO -- chrome-test-centos-70:   * log[chrome version] action write[2014-12-09T02:00:01+00:00] INFO: Processing log[chrome version] action write (chrome_test::version line 5)
I, [2014-12-08T19:00:02.069615 #57373]  INFO -- chrome-test-centos-70: [2014-12-09T02:00:01+00:00] INFO: 39.0.2171.71 
I, [2014-12-08T19:00:02.069635 #57373]  INFO -- chrome-test-centos-70: 
I, [2014-12-08T19:00:02.069655 #57373]  INFO -- chrome-test-centos-70:   
I, [2014-12-08T19:00:02.069692 #57373]  INFO -- chrome-test-centos-70: �[0mRecipe: chrome_test::master_preferences�[0m
I, [2014-12-08T19:00:02.069745 #57373]  INFO -- chrome-test-centos-70:   * chrome[set_user_preferences] action master_preferences[2014-12-09T02:00:01+00:00] INFO: Processing chrome[set_user_preferences] action master_preferences (chrome_test::master_preferences line 1)
I, [2014-12-08T19:00:02.069768 #57373]  INFO -- chrome-test-centos-70: 
I, [2014-12-08T19:00:02.069787 #57373]  INFO -- chrome-test-centos-70:     �[0m
I, [2014-12-08T19:00:02.069807 #57373]  INFO -- chrome-test-centos-70:     ================================================================================�[0m
I, [2014-12-08T19:00:02.069827 #57373]  INFO -- chrome-test-centos-70:     �[31mError executing action `master_preferences` on resource 'chrome[set_user_preferences]'�[0m
I, [2014-12-08T19:00:02.069846 #57373]  INFO -- chrome-test-centos-70:     ================================================================================�[0m
I, [2014-12-08T19:00:02.069866 #57373]  INFO -- chrome-test-centos-70:     
I, [2014-12-08T19:00:02.069885 #57373]  INFO -- chrome-test-centos-70: �[0m    NoMethodError�[0m
I, [2014-12-08T19:00:02.069904 #57373]  INFO -- chrome-test-centos-70:     -------------�[0m
I, [2014-12-08T19:00:02.069924 #57373]  INFO -- chrome-test-centos-70:     undefined method `new' for Chrome:Module�[0m
I, [2014-12-08T19:00:02.069943 #57373]  INFO -- chrome-test-centos-70:     
I, [2014-12-08T19:00:02.069963 #57373]  INFO -- chrome-test-centos-70: �[0m    Resource Declaration:�[0m
I, [2014-12-08T19:00:02.069982 #57373]  INFO -- chrome-test-centos-70:     ---------------------�[0m
I, [2014-12-08T19:00:02.070002 #57373]  INFO -- chrome-test-centos-70:     # In /tmp/kitchen/cookbooks/chrome_test/recipes/master_preferences.rb
I, [2014-12-08T19:00:02.070048 #57373]  INFO -- chrome-test-centos-70: �[0m    
I, [2014-12-08T19:00:02.070069 #57373]  INFO -- chrome-test-centos-70: �[0m      1: chrome 'set_user_preferences' do
I, [2014-12-08T19:00:02.070088 #57373]  INFO -- chrome-test-centos-70: �[0m      2:   cookbook 'chrome'
I, [2014-12-08T19:00:02.070107 #57373]  INFO -- chrome-test-centos-70: �[0m      3:   params(
I, [2014-12-08T19:00:02.070127 #57373]  INFO -- chrome-test-centos-70: �[0m      4:     homepage: 'https://www.getchef.com'
I, [2014-12-08T19:00:02.070147 #57373]  INFO -- chrome-test-centos-70: �[0m      5:   )
I, [2014-12-08T19:00:02.070166 #57373]  INFO -- chrome-test-centos-70: �[0m      6:   action :master_preferences
I, [2014-12-08T19:00:02.070186 #57373]  INFO -- chrome-test-centos-70: �[0m      7: end
I, [2014-12-08T19:00:02.070205 #57373]  INFO -- chrome-test-centos-70: �[0m    
I, [2014-12-08T19:00:02.070225 #57373]  INFO -- chrome-test-centos-70: �[0m    Compiled Resource:�[0m
I, [2014-12-08T19:00:02.070244 #57373]  INFO -- chrome-test-centos-70:     ------------------�[0m
I, [2014-12-08T19:00:02.070263 #57373]  INFO -- chrome-test-centos-70:     # Declared in /tmp/kitchen/cookbooks/chrome_test/recipes/master_preferences.rb:1:in `from_file'
I, [2014-12-08T19:00:02.070283 #57373]  INFO -- chrome-test-centos-70: �[0m    
I, [2014-12-08T19:00:02.070302 #57373]  INFO -- chrome-test-centos-70: �[0m    chrome("set_user_preferences") do
I, [2014-12-08T19:00:02.070321 #57373]  INFO -- chrome-test-centos-70: �[0m      params {:homepage=>"https://www.getchef.com"}
I, [2014-12-08T19:00:02.070341 #57373]  INFO -- chrome-test-centos-70: �[0m      action [:master_preferences]
I, [2014-12-08T19:00:02.070360 #57373]  INFO -- chrome-test-centos-70: �[0m      retries 0
I, [2014-12-08T19:00:02.070380 #57373]  INFO -- chrome-test-centos-70: �[0m      retry_delay 2
I, [2014-12-08T19:00:02.070399 #57373]  INFO -- chrome-test-centos-70: �[0m      default_guard_interpreter :default
I, [2014-12-08T19:00:02.070446 #57373]  INFO -- chrome-test-centos-70: �[0m      cookbook_name :chrome_test
I, [2014-12-08T19:00:02.070466 #57373]  INFO -- chrome-test-centos-70: �[0m      recipe_name "master_preferences"
I, [2014-12-08T19:00:02.070486 #57373]  INFO -- chrome-test-centos-70: �[0m      cookbook "chrome"
I, [2014-12-08T19:00:02.070512 #57373]  INFO -- chrome-test-centos-70: �[0m    end
I, [2014-12-08T19:00:02.070533 #57373]  INFO -- chrome-test-centos-70: �[0m    
I, [2014-12-08T19:00:02.070552 #57373]  INFO -- chrome-test-centos-70: �[0m[2014-12-09T02:00:01+00:00] INFO: Running queued delayed notifications before re-raising exception
I, [2014-12-08T19:00:02.070572 #57373]  INFO -- chrome-test-centos-70: �[0m
I, [2014-12-08T19:00:02.070591 #57373]  INFO -- chrome-test-centos-70: Running handlers:�[0m
I, [2014-12-08T19:00:02.070610 #57373]  INFO -- chrome-test-centos-70: [2014-12-09T02:00:01+00:00] ERROR: Running exception handlers
I, [2014-12-08T19:00:02.070630 #57373]  INFO -- chrome-test-centos-70: Running handlers complete
I, [2014-12-08T19:00:02.070649 #57373]  INFO -- chrome-test-centos-70: �[0m[2014-12-09T02:00:01+00:00] ERROR: Exception handlers complete
I, [2014-12-08T19:00:02.093023 #57373]  INFO -- chrome-test-centos-70: [2014-12-09T02:00:01+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
I, [2014-12-08T19:00:02.093085 #57373]  INFO -- chrome-test-centos-70: Chef Client failed. 1 resources updated in 19.645034043 seconds�[0m
[2014-12-09T02:00:01+00:00] ERROR: chrome[set_user_preferences] (chrome_test::master_preferences line 1) had an error: NoMethodError: undefined method `new' for Chrome:ModuleI, [2014-12-08T19:00:02.142982 #57373]  INFO -- chrome-test-centos-70: 
I, [2014-12-08T19:00:02.195003 #57373]  INFO -- chrome-test-centos-70: [2014-12-09T02:00:02+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
E, [2014-12-08T19:00:02.243312 #57373] ERROR -- chrome-test-centos-70: Converge failed on instance <chrome-test-centos-70>.
E, [2014-12-08T19:00:02.243474 #57373] ERROR -- chrome-test-centos-70: ------Exception-------
E, [2014-12-08T19:00:02.243534 #57373] ERROR -- chrome-test-centos-70: Class: Kitchen::ActionFailed
E, [2014-12-08T19:00:02.243558 #57373] ERROR -- chrome-test-centos-70: Message: SSH exited (1) for command: [sudo -E chef-solo --config /tmp/kitchen/solo.rb --json-attributes /tmp/kitchen/dna.json  --log_level info]
E, [2014-12-08T19:00:02.243577 #57373] ERROR -- chrome-test-centos-70: ---Nested Exception---
E, [2014-12-08T19:00:02.243593 #57373] ERROR -- chrome-test-centos-70: Class: Kitchen::SSHFailed
E, [2014-12-08T19:00:02.243610 #57373] ERROR -- chrome-test-centos-70: Message: SSH exited (1) for command: [sudo -E chef-solo --config /tmp/kitchen/solo.rb --json-attributes /tmp/kitchen/dna.json  --log_level info]
E, [2014-12-08T19:00:02.243628 #57373] ERROR -- chrome-test-centos-70: ------Backtrace-------
E, [2014-12-08T19:00:02.243647 #57373] ERROR -- chrome-test-centos-70: /Users/hoerde/.rvm/gems/ruby-2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/driver/ssh_base.rb:112:in `rescue in run_remote'
E, [2014-12-08T19:00:02.243665 #57373] ERROR -- chrome-test-centos-70: /Users/hoerde/.rvm/gems/ruby-2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/driver/ssh_base.rb:108:in `run_remote'
E, [2014-12-08T19:00:02.243682 #57373] ERROR -- chrome-test-centos-70: /Users/hoerde/.rvm/gems/ruby-2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/driver/ssh_base.rb:48:in `block in converge'
E, [2014-12-08T19:00:02.243700 #57373] ERROR -- chrome-test-centos-70: /Users/hoerde/.rvm/gems/ruby-2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/ssh.rb:47:in `initialize'
E, [2014-12-08T19:00:02.243718 #57373] ERROR -- chrome-test-centos-70: /Users/hoerde/.rvm/gems/ruby-2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/driver/ssh_base.rb:43:in `new'
E, [2014-12-08T19:00:02.243735 #57373] ERROR -- chrome-test-centos-70: /Users/hoerde/.rvm/gems/ruby-2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/driver/ssh_base.rb:43:in `converge'
E, [2014-12-08T19:00:02.243754 #57373] ERROR -- chrome-test-centos-70: /Users/hoerde/.rvm/gems/ruby-2.1.0/gems/kitchen-vagrant-0.15.0/lib/kitchen/driver/vagrant.rb:75:in `converge'
E, [2014-12-08T19:00:02.243772 #57373] ERROR -- chrome-test-centos-70: /Users/hoerde/.rvm/gems/ruby-2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/instance.rb:273:in `public_send'
E, [2014-12-08T19:00:02.243801 #57373] ERROR -- chrome-test-centos-70: /Users/hoerde/.rvm/gems/ruby-2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/instance.rb:273:in `block in perform_action'
E, [2014-12-08T19:00:02.243820 #57373] ERROR -- chrome-test-centos-70: /Users/hoerde/.rvm/gems/ruby-2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/instance.rb:308:in `call'
E, [2014-12-08T19:00:02.243838 #57373] ERROR -- chrome-test-centos-70: /Users/hoerde/.rvm/gems/ruby-2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/instance.rb:308:in `synchronize_or_call'
E, [2014-12-08T19:00:02.243856 #57373] ERROR -- chrome-test-centos-70: /Users/hoerde/.rvm/gems/ruby-2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/instance.rb:283:in `block in action'
E, [2014-12-08T19:00:02.243874 #57373] ERROR -- chrome-test-centos-70: /Users/hoerde/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
E, [2014-12-08T19:00:02.243891 #57373] ERROR -- chrome-test-centos-70: /Users/hoerde/.rvm/gems/ruby-2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/instance.rb:282:in `action'
E, [2014-12-08T19:00:02.243909 #57373] ERROR -- chrome-test-centos-70: /Users/hoerde/.rvm/gems/ruby-2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/instance.rb:273:in `perform_action'
E, [2014-12-08T19:00:02.243927 #57373] ERROR -- chrome-test-centos-70: /Users/hoerde/.rvm/gems/ruby-2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/instance.rb:256:in `converge_action'
E, [2014-12-08T19:00:02.243979 #57373] ERROR -- chrome-test-centos-70: /Users/hoerde/.rvm/gems/ruby-2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/instance.rb:246:in `block in transition_to'
E, [2014-12-08T19:00:02.243997 #57373] ERROR -- chrome-test-centos-70: /Users/hoerde/.rvm/gems/ruby-2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/instance.rb:245:in `each'
E, [2014-12-08T19:00:02.244014 #57373] ERROR -- chrome-test-centos-70: /Users/hoerde/.rvm/gems/ruby-2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/instance.rb:245:in `transition_to'
E, [2014-12-08T19:00:02.244032 #57373] ERROR -- chrome-test-centos-70: /Users/hoerde/.rvm/gems/ruby-2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/instance.rb:141:in `verify'
E, [2014-12-08T19:00:02.244050 #57373] ERROR -- chrome-test-centos-70: /Users/hoerde/.rvm/gems/ruby-2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/command.rb:109:in `public_send'
E, [2014-12-08T19:00:02.244069 #57373] ERROR -- chrome-test-centos-70: /Users/hoerde/.rvm/gems/ruby-2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/command.rb:109:in `block (2 levels) in run_action'
E, [2014-12-08T19:00:02.244086 #57373] ERROR -- chrome-test-centos-70: ----------------------
@lamont-granquist
Copy link
Contributor

Can you 'kitchen login' to the virt and grab /tmp/kitchen/cache/chef-stacktrace.out -- that's the file that is going to have the most relevant info about what is crashing. The t-k backtrace is just showing that t-k is blowing up because the chef-client converge failed and ssh exited non-zero.

@dhoer
Copy link
Author

dhoer commented Dec 9, 2014

[vagrant@chrome-test-centos-70 ~]$ sudo cat  /tmp/kitchen/cache/chef-stacktrace.out
Generated at 2014-12-09 02:31:07 +0000
NoMethodError: chrome[set_user_preferences] (chrome_test::master_preferences line 1) had an error: NoMethodError: undefined method `new' for Chrome:Module
/opt/chef/embedded/apps/chef/lib/chef/resource.rb:683:in `provider_for_action'
/opt/chef/embedded/apps/chef/lib/chef/resource.rb:654:in `run_action'
/opt/chef/embedded/apps/chef/lib/chef/runner.rb:49:in `run_action'
/opt/chef/embedded/apps/chef/lib/chef/runner.rb:81:in `block (2 levels) in converge'
/opt/chef/embedded/apps/chef/lib/chef/runner.rb:81:in `each'
/opt/chef/embedded/apps/chef/lib/chef/runner.rb:81:in `block in converge'
/opt/chef/embedded/apps/chef/lib/chef/resource_collection/resource_list.rb:83:in `block in execute_each_resource'
/opt/chef/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
/opt/chef/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
/opt/chef/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/opt/chef/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
/opt/chef/embedded/apps/chef/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/opt/chef/embedded/apps/chef/lib/chef/resource_collection/resource_list.rb:81:in `execute_each_resource'
/opt/chef/embedded/apps/chef/lib/chef/runner.rb:80:in `converge'
/opt/chef/embedded/apps/chef/lib/chef/client.rb:315:in `converge'
/opt/chef/embedded/apps/chef/lib/chef/client.rb:400:in `block in run'
/opt/chef/embedded/apps/chef/lib/chef/client.rb:399:in `catch'
/opt/chef/embedded/apps/chef/lib/chef/client.rb:399:in `run'
/opt/chef/embedded/apps/chef/lib/chef/application.rb:261:in `block in fork_chef_client'
/opt/chef/embedded/apps/chef/lib/chef/application.rb:249:in `fork'
/opt/chef/embedded/apps/chef/lib/chef/application.rb:249:in `fork_chef_client'
/opt/chef/embedded/apps/chef/lib/chef/application.rb:215:in `block in run_chef_client'
/opt/chef/embedded/apps/chef/lib/chef/local_mode.rb:38:in `with_server_connectivity'
/opt/chef/embedded/apps/chef/lib/chef/application.rb:201:in `run_chef_client'
/opt/chef/embedded/apps/chef/lib/chef/application/solo.rb:245:in `block in interval_run_chef_client'
/opt/chef/embedded/apps/chef/lib/chef/application/solo.rb:234:in `loop'
/opt/chef/embedded/apps/chef/lib/chef/application/solo.rb:234:in `interval_run_chef_client'
/opt/chef/embedded/apps/chef/lib/chef/application/solo.rb:224:in `run_application'
/opt/chef/embedded/apps/chef/lib/chef/application.rb:58:in `run'
/opt/chef/embedded/apps/chef/bin/chef-solo:25:in `<top (required)>'
/bin/chef-solo:40:in `load'
/bin/chef-solo:40:in `<main>'[vagrant@chrome-test-centos-70 ~]$

@lamont-granquist
Copy link
Contributor

So, I think its definitely not the Recipe DSL issue. The ProviderResolver seems to be spitting out your module Chrome class as a solution which makes no sense at all to me.

It'd be useful to run it again with -l debug. You might have to do something like:

kitchen login
cd /tmp/kitchen
sudo bash
chef-client -z -c client.rb -j dna.json -l debug

I'm mostly just interested in the debug logging coming from the provider resolver on the chrome resource and finding out what these lines are doing right before it all goes sideways:

https://github.com/opscode/chef/blob/master/lib/chef/provider_resolver.rb#L71-L101

@dhoer
Copy link
Author

dhoer commented Dec 9, 2014

Here you go. As a sanity check, can you verify you get the same on test-kitchen? I think my machine is fine, but I would like to rule that out by seeing if someone else sees the same thing.

git clone git@github.com:dhoer/chef-chrome.git

Recipe: chrome_test::master_preferences
  * chrome[set_user_preferences] action master_preferences[2014-12-09T02:52:19+00:00] INFO: Processing chrome[set_user_preferences] action master_preferences (chrome_test::master_preferences line 1)
[2014-12-09T02:52:19+00:00] DEBUG: providers for generic chrome resource enabled on node include: []
[2014-12-09T02:52:19+00:00] DEBUG: providers that refused resource chrome[set_user_preferences] were: []
[2014-12-09T02:52:19+00:00] DEBUG: providers that support resource chrome[set_user_preferences] include: []
[2014-12-09T02:52:19+00:00] DEBUG: no providers supported the resource, falling back to enabled handlers
[2014-12-09T02:52:19+00:00] DEBUG: providers that survived replacement include: []
[2014-12-09T02:52:19+00:00] DEBUG: dynamic provider resolver FAILED to resolve a provider

@lamont-granquist
Copy link
Contributor

You might try just renaming your "module Chrome" to something else. That might work around the problem if you can do that without breaking your API (looks like you injected some helpers into the various DSL classes, so hopefully that wouldn't break anyone downstream of you).

@dhoer
Copy link
Author

dhoer commented Dec 9, 2014

Wow! Thanks, that worked. How did you figure that out?

@dhoer dhoer closed this as completed Dec 9, 2014
@lamont-granquist
Copy link
Contributor

Well its sorta right there: "NoMethodError: undefined method `new' for Chrome:Module"

And the ProviderResolver is falling back to constructing the provider based on the classname, so it should be passing back Chef::Provider::Chrome and calling #new on that, but its calling Chrome#new instead and picking up your module for some reason. So it smells like some class heirarchy searching bug. But I'm not sure what the exact bug is or why it doesn't affect Chef-11, since its not in the ProviderResolver class itself, but its falling through into the old provider resolution and I'm not aware of any behavior that I changed there...

Anyway, I'm going to keep this left open because we've still clearly got a bug here even if the workaround works for you...

@dhoer
Copy link
Author

dhoer commented Dec 9, 2014

Ok, thanks so much for your help! I released a patched version of Chrome with modules removed.

If I had to guess, the cookbook parameter must trigger a little used conditional statement: https://github.com/dhoer/chef-chrome/blob/master/test/fixtures/cookbooks/chrome_test/recipes/master_preferences.rb#L2

I borrowed this pattern from apache2 web_app. I used LWRP they use HWRP. I wonder if they are having similar issues.

@martinb3
Copy link
Contributor

martinb3 commented Dec 9, 2014

FWIW, I've seen this issue in at least one other case as well (ark). Someone has done a really good job of documenting the issue in their issue tracker: sous-chefs/ark#92

@carguel
Copy link

carguel commented Dec 12, 2014

@lamont-granquist Could not this issue be caused by the new version of ruby introduced in Chef 12 ?

@lamont-granquist
Copy link
Contributor

Yeah, that's my suspicion. I haven't had time to dig into it, though, and since there's a workaround for it (just rename the class), it's been a lower priority that some other straight forward breakage that we've been fixing in 12.

@lamont-granquist
Copy link
Contributor

I'd be kind of interesting to see if chef-11 on ruby 2.1.x exhibited the same symptoms.

@martinb3
Copy link
Contributor

I know we've used ruby 2.1.x in dev and never seen this until the chef-12 upgrade. Unfortunately, it's been difficult for us to persuade upstream to rename the classes, so we're thinking we try to dig into it as well.

@lamont-granquist lamont-granquist added this to the 12.0.4 milestone Dec 18, 2014
@lamont-granquist lamont-granquist modified the milestones: 12.1.0, 12.0.4 Jan 23, 2015
@carguel
Copy link

carguel commented Feb 1, 2015

@lamont-granquist

I made a deeper analysis of this issue and found a possible fix.

I used the Ark cookbook to reproduce and debug this issue in a pry session. Ark cookbook is affected by this issue in current master branch (see sous-chefs/ark#92). This cookbook defines some library methods inside an Ark module, which conflicts with Chef::Provider::Ark provider class.

According to my analysis, what causes this issue is that the Ark provider is never created. This is the reason why the top level Ark module is returned by Chef::ProviderResolver::resolve method in place of the expected Ark provider.
This actually occurs in the following method:

https://github.com/chef/chef/blob/master/lib/chef/platform/provider_mapping.rb#L571:L581

When this method is executed, Pry confirms that the Chef::Provider::Ark class does not exist. Therefore, the const_get method, try to search the 'Ark' constant name from ancestors (see http://ruby-doc.org/core-2.1.0/Module.html#method-i-const_get). It finds this constant in the Object ancestor as it defines the Ark module.

To fix the root cause I made a change in the following method:

https://github.com/chef/chef/blob/master/lib/chef/provider/lwrp_base.rb#L83:L98

I replaced the following block:

  if Chef::Provider.const_defined?(class_name)
    Chef::Log.info("#{class_name} light-weight provider is already initialized -- Skipping loading #{filename}!")
    Chef::Log.debug("Overriding already defined LWRPs is not supported anymore starting with Chef 12.")
    provider_class = Chef::Provider.const_get(class_name)

by

  if Chef::Provider.const_defined?(class_name, false)
    Chef::Log.info("#{class_name} light-weight provider is already initialized -- Skipping loading #{filename}!")
    Chef::Log.debug("Overriding already defined LWRPs is not supported anymore starting with Chef 12.")
    provider_class = Chef::Provider.const_get(class_name, false)

Adding false to const_defined? and const_get method calls prevents to mismatch the Ark module and the Chef::Provider::Ark provider class.

I let you assess if this change is a valid fix and does not introduce unexpected side effects.

@lamont-granquist
Copy link
Contributor

Yeah, I think that totally makes sense. The first time through that code Chef::Provider::Ark shouldn't exist , but if it goes up the inheritance tree it'll find 'Ark' (presumably defined off of 'Object' due to magick?), and then it fails to properly define the provider the first time because it thinks it has already created it (and the resource the same way)

Want to submit a PR for that?

@takesson
Copy link

I found this issue when researching the message NoMethodError undefined method `exists' for ... (method exists instead of new). This message replaced the actual error reported by a raise statement in the resource.

I was able to resolve the issue by removing state_attrs :exists from the resource. Not sure why that line was in there (I am not the original author of the resource).

Hope this helps someone in the future.

@chef chef locked and limited conversation to collaborators Nov 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants