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

ohai plugin_path logic doesn't work with Chef local mode #55

Open
gopisaba opened this issue Dec 18, 2016 · 4 comments
Open

ohai plugin_path logic doesn't work with Chef local mode #55

gopisaba opened this issue Dec 18, 2016 · 4 comments
Labels
Type: Bug Doesn't work as expected. Type: Enhancement Adds new functionality.

Comments

@gopisaba
Copy link

gopisaba commented Dec 18, 2016

Cookbook version

4.2.3

Chef-client version

12.17.44

Platform Details

Windows 2012 R2 - AWS

Scenario:

I am trying to install IIS with iis cookbook (5.0.5)
depends on windows cookbook (2.1.1)

Steps to Reproduce:

recipes/default.rb

include_recipe 'iis::mod_aspnet45'
include_recipe 'iis::remove_default_site'

Expected Result:

Expected to install IIS

Actual Result:

End with the error message

[2016-12-18T20:08:33+00:00] INFO: Processing windows_feature[IIS-WebServerRole] action install (iis::default line 25)
[2016-12-18T20:08:33+00:00] INFO: node['dism_features'] data missing. Installing the dism_features Ohai plugin
[2016-12-18T20:08:33+00:00] INFO: Processing ohai_plugin[dism_features] action create (C:/Windows/system32/config/systemprofile/.chef/local-mode-cache/cache/cookbooks/windows/providers/feature_dism.rb line 79)
[2016-12-18T20:08:33+00:00] FATAL: No chef config file defined. Are you running chef-solo? If so you will need to define a path for the ohai_plugin as the path cannot be determined
[2016-12-18T20:08:33+00:00] INFO: Running queued delayed notifications before re-raising exception
[2016-12-18T20:08:33+00:00] ERROR: Running exception handlers
[2016-12-18T20:08:33+00:00] ERROR: Exception handlers complete
[2016-12-18T20:08:33+00:00] FATAL: Stacktrace dumped to C:/Windows/system32/config/systemprofile/.chef/local-mode-cache/cache/chef-stacktrace.out
[2016-12-18T20:08:33+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report

chef-stacktrace.out

Generated at 2016-12-18 20:16:16 +0000
SystemExit: windows_feature[IIS-WebServerRole] (iis::default line 25) had an error: SystemExit: ohai_plugin[dism_features] (C:/Windows/system32/config/systemprofile/.chef/local-mode-cache/cache/cookbooks/windows/providers/feature_dism.rb line 79) had an error: SystemExit: exit
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/application.rb:367:in `exit'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/application.rb:367:in `fatal!'
C:/Windows/system32/config/systemprofile/.chef/local-mode-cache/cache/cookbooks/ohai/resources/plugin.rb:25:in `chef_config_path'
C:/Windows/system32/config/systemprofile/.chef/local-mode-cache/cache/cookbooks/ohai/resources/plugin.rb:33:in `ohai_plugin_path'
C:/Windows/system32/config/systemprofile/.chef/local-mode-cache/cache/cookbooks/ohai/resources/plugin.rb:16:in `desired_plugin_path'
C:/Windows/system32/config/systemprofile/.chef/local-mode-cache/cache/cookbooks/ohai/resources/plugin.rb:80:in `block in class_from_file'
(eval):2:in `block in action_create'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/provider.rb:361:in `instance_eval'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/provider.rb:361:in `compile_and_converge_action'
(eval):2:in `action_create'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/provider.rb:145:in `run_action'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/resource.rb:622:in `run_action'
C:/Windows/system32/config/systemprofile/.chef/local-mode-cache/cache/cookbooks/ohai/resources/plugin.rb:131:in `block in after_created'
C:/Windows/system32/config/systemprofile/.chef/local-mode-cache/cache/cookbooks/ohai/resources/plugin.rb:130:in `each'
C:/Windows/system32/config/systemprofile/.chef/local-mode-cache/cache/cookbooks/ohai/resources/plugin.rb:130:in `after_created'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/resource_builder.rb:92:in `build'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/dsl/declare_resource.rb:291:in `build_resource'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/dsl/declare_resource.rb:248:in `declare_resource'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/dsl/resources.rb:40:in `ohai_plugin'
C:/Windows/system32/config/systemprofile/.chef/local-mode-cache/cache/cookbooks/windows/providers/feature_dism.rb:79:in `install_ohai_plugin'
C:/Windows/system32/config/systemprofile/.chef/local-mode-cache/cache/cookbooks/windows/providers/feature_dism.rb:53:in `installed?'
C:/Windows/system32/config/systemprofile/.chef/local-mode-cache/cache/cookbooks/windows/libraries/feature_base.rb:6:in `action_install'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/provider.rb:145:in `run_action'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/resource.rb:622:in `run_action'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/runner.rb:69:in `run_action'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/runner.rb:97:in `block (2 levels) in converge'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/runner.rb:97:in `each'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/runner.rb:97:in `block in converge'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/resource_collection/resource_list.rb:94:in `block in execute_each_resource'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:114:in `call_iterator_block'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:103:in `iterate'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/resource_collection/resource_list.rb:92:in `execute_each_resource'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/runner.rb:96:in `converge'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/client.rb:670:in `block in converge'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/client.rb:665:in `catch'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/client.rb:665:in `converge'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/client.rb:704:in `converge_and_save'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/client.rb:284:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/application.rb:276:in `run_with_graceful_exit_option'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/application.rb:252:in `block in run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/local_mode.rb:44:in `with_server_connectivity'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/application.rb:235:in `run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/application/client.rb:464:in `sleep_then_run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/application/client.rb:451:in `block in interval_run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/application/client.rb:450:in `loop'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/application/client.rb:450:in `interval_run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/application/client.rb:434:in `run_application'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/application.rb:59:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/bin/chef-client:26:in `<top (required)>'
C:/opscode/chef/bin/chef-client:68:in `load'
C:/opscode/chef/bin/chef-client:68:in `<main>'

>>>> Caused by SystemExit: exit
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/application.rb:367:in `exit'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/application.rb:367:in `fatal!'
C:/Windows/system32/config/systemprofile/.chef/local-mode-cache/cache/cookbooks/ohai/resources/plugin.rb:25:in `chef_config_path'
C:/Windows/system32/config/systemprofile/.chef/local-mode-cache/cache/cookbooks/ohai/resources/plugin.rb:33:in `ohai_plugin_path'
C:/Windows/system32/config/systemprofile/.chef/local-mode-cache/cache/cookbooks/ohai/resources/plugin.rb:16:in `desired_plugin_path'
C:/Windows/system32/config/systemprofile/.chef/local-mode-cache/cache/cookbooks/ohai/resources/plugin.rb:80:in `block in class_from_file'
(eval):2:in `block in action_create'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/provider.rb:361:in `instance_eval'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/provider.rb:361:in `compile_and_converge_action'
(eval):2:in `action_create'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/provider.rb:145:in `run_action'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/resource.rb:622:in `run_action'
C:/Windows/system32/config/systemprofile/.chef/local-mode-cache/cache/cookbooks/ohai/resources/plugin.rb:131:in `block in after_created'
C:/Windows/system32/config/systemprofile/.chef/local-mode-cache/cache/cookbooks/ohai/resources/plugin.rb:130:in `each'
C:/Windows/system32/config/systemprofile/.chef/local-mode-cache/cache/cookbooks/ohai/resources/plugin.rb:130:in `after_created'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/resource_builder.rb:92:in `build'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/dsl/declare_resource.rb:291:in `build_resource'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/dsl/declare_resource.rb:248:in `declare_resource'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/dsl/resources.rb:40:in `ohai_plugin'
C:/Windows/system32/config/systemprofile/.chef/local-mode-cache/cache/cookbooks/windows/providers/feature_dism.rb:79:in `install_ohai_plugin'
C:/Windows/system32/config/systemprofile/.chef/local-mode-cache/cache/cookbooks/windows/providers/feature_dism.rb:53:in `installed?'
C:/Windows/system32/config/systemprofile/.chef/local-mode-cache/cache/cookbooks/windows/libraries/feature_base.rb:6:in `action_install'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/provider.rb:145:in `run_action'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/resource.rb:622:in `run_action'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/runner.rb:69:in `run_action'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/runner.rb:97:in `block (2 levels) in converge'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/runner.rb:97:in `each'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/runner.rb:97:in `block in converge'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/resource_collection/resource_list.rb:94:in `block in execute_each_resource'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:114:in `call_iterator_block'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:103:in `iterate'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/resource_collection/resource_list.rb:92:in `execute_each_resource'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/runner.rb:96:in `converge'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/client.rb:670:in `block in converge'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/client.rb:665:in `catch'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/client.rb:665:in `converge'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/client.rb:704:in `converge_and_save'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/client.rb:284:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/application.rb:276:in `run_with_graceful_exit_option'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/application.rb:252:in `block in run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/local_mode.rb:44:in `with_server_connectivity'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/application.rb:235:in `run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/application/client.rb:464:in `sleep_then_run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/application/client.rb:451:in `block in interval_run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/application/client.rb:450:in `loop'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/application/client.rb:450:in `interval_run_chef_client'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/application/client.rb:434:in `run_application'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/lib/chef/application.rb:59:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.17.44-universal-mingw32/bin/chef-client:26:in `<top (required)>'
C:/opscode/chef/bin/chef-client:68:in `load'
C:/opscode/chef/bin/chef-client:68:in `<main>'

There is no such error if I use windows cookbook 2.0.2

@tas50 tas50 changed the title Plugin_path configuration issue ohai plugin_path logic doesn't work with Chef local mode Dec 22, 2016
@tas50 tas50 added the Type: Enhancement Adds new functionality. label Dec 22, 2016
@iennae iennae added the Type: Bug Doesn't work as expected. label Mar 31, 2017
@rambler
Copy link

rambler commented Aug 8, 2017

Are there any workarounds for this?

Here's the text: "If so you will need to define a path for the ohai_plugin as the path cannot be determined". How can I define a path for the ohai_plugin?

@adhodgson1
Copy link

I check on this from time to time because it has kept me on a very old Windows cookbook for over a year, and also an older Chef release. Is there no workaround available or has this been fixed in a later release somehow?

@jakauppila
Copy link

I'd love to dig into this if someone could point me in the right direction on where to start.

@tylrd
Copy link

tylrd commented Apr 29, 2018

I was able to get through this error by creating an empty client.rb file and running the chef client:

$ sudo chef-client -z -c client.rb

Seems like it's caused by ohai checking for the existing of a config file here: https://github.com/chef-cookbooks/ohai/blob/master/libraries/plugin_helpers.rb#L39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Doesn't work as expected. Type: Enhancement Adds new functionality.
Projects
None yet
Development

No branches or pull requests

7 participants