Ohai resource: reloading a specific plugin which is marked as "optional" is ignored
Open
@dheerajd-msys is already working on this.
Since Jun 15, 2020.
Focus: Resources
Type: Bug
- Dominant language
- Ruby
- Stars
- 8.2k
- Forks
- 2.5k
- Avg merge
- 4d 5h
- Merged PRs (30d)
- 23
Description
Description
Running the example from https://docs.chef.io/resource_ohai.html fails with chef-client >= 14.
Chef Version
Tested with 15.2.20 and 14.13.11
Platform Version
Ubuntu 18.04
Replication Case
Create a cookbook with a recipe containing the example code from the ohai resource. On the first run, when the new user is actually created, the ruby code block fails. With 13.12.14 the code runs without error.
Client Output
* ruby_block[just an example] action run[2019-08-22T10:41:48+00:00] INFO: Processing ruby_block[just an example] action run (xion_prometheus::test line 13)
================================================================================
Error executing action `run` on resource 'ruby_block[just an example]'
================================================================================
NoMethodError
-------------
undefined method `[]' for nil:NilClass
Cookbook Trace:
---------------
/var/chef/cache/cookbooks/tests/recipes/test.rb:16:in `block (2 levels) in from_file'
Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/tests/recipes/test.rb
13: ruby_block 'just an example' do
14: block do
15: # These variables will now have the new values
16: puts node['etc']['passwd']['daemonuser']['uid']
17: puts node['etc']['passwd']['daemonuser']['gid']
18: end
19: end
Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/tests/recipes/test.rb:13:in `from_file'
ruby_block("just an example") do
action [:run]
default_guard_interpreter :default
declared_type :ruby_block
cookbook_name "tests"
recipe_name "test"
block #<Proc:0x0000000004c08448@/var/chef/cache/cookbooks/tests/recipes/test.rb:14>
block_name "just an example"
end
System Info:
------------
chef_version=15.2.20
platform=ubuntu
platform_version=18.04
ruby=ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
program_name=/usr/bin/chef-client
executable=/opt/chef/bin/chef-client
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.