From 57583bf02619b04e26f8521a25be5075bb1f9cc0 Mon Sep 17 00:00:00 2001 From: James Cuzella Date: Sat, 3 Apr 2021 18:13:10 -0600 Subject: [PATCH] Always run Ohai Passwd plugin to support Chef >= 14.0.13 - Force run of Ohai Passwd plugin to populate `node['etc']['passwd']` for Chef/Ohai >= 14.0.13 - Guard with `ohai.respond_to?(optional_plugins)` to support older Chef + Ohai versions References: - https://github.com/chef/ohai/blob/master/RELEASE_NOTES.md#optional-ohai-plugins - https://stackoverflow.com/a/57953198/64549 --- lib/soloist/config.rb | 1 + spec/lib/soloist/config_spec.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/soloist/config.rb b/lib/soloist/config.rb index 42c6d9e..38b82b5 100644 --- a/lib/soloist/config.rb +++ b/lib/soloist/config.rb @@ -28,6 +28,7 @@ def as_solo_rb file_cache_path "#{chef_cache_path}" cookbook_path #{cookbook_paths.inspect} json_attribs "#{node_json_path}" + ohai.optional_plugins = [ :Passwd ] if ohai.respond_to?(:optional_plugins) SOLO_RB end diff --git a/spec/lib/soloist/config_spec.rb b/spec/lib/soloist/config_spec.rb index 60ee888..c0f679f 100644 --- a/spec/lib/soloist/config_spec.rb +++ b/spec/lib/soloist/config_spec.rb @@ -12,6 +12,7 @@ it { should include 'file_cache_path "/var/chef/cache"' } it { should include %(json_attribs "#{config.node_json_path}") } + it { should include 'ohai.optional_plugins = [ :Passwd ] if ohai.respond_to?(:optional_plugins)' } end describe "#cookbook_paths" do